]> git.codecow.com Git - nano-pow.git/commitdiff
Fix self-check.
authorChris Duncan <chris@codecow.com>
Sun, 26 Jul 2026 05:00:51 +0000 (22:00 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 26 Jul 2026 05:00:51 +0000 (22:00 -0700)
index.html

index e88f5636e544d20d0eb1c71e94c52c68197ba6f2..4a2c2619f366accfbf0436549961c19dc5a69c12 100644 (file)
@@ -168,18 +168,18 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                        logger.log(`work_validate() output for bad receive difficulty nonce is ${result === true ? 'correct' : 'incorrect'}`)
                                        expect.push(result)
 
-                                       const prefixes = [
-                                               'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
-                                               '0Xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
-                                               '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
-                                               ' 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
-                                               ' ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
-                                               'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
-                                       ]
+                       const prefixes = [
+                               'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+                               '0Xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+                               '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
+                                       ' 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
+                               ' ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
+                               'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
+                       ]
                        for (let i = 0; i < prefixes.length; i++) {
                                const hash = prefixes[i]
                                try {
-                                       const result = await NanoPow.work_generate(hash, options)
+                                       result = await NanoPow.work_generate(hash, options)
                                        logger.log(result)
                                } catch (err) {
                                        document.getElementById('output').innerHTML += `Error: ${err.message}<br/>${err.cause}<br/>${err.stack}`
@@ -195,8 +195,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
                        if (!expect.every(result => result)) {
                                document.getElementById('status').innerHTML = `FAILED TO VALIDATE KNOWN VALUES`
-                               document.getElementById('output').innerHTML += `Error: ${err.message}<br/>`
-                               console.error(err)
+                               document.getElementById('output').innerHTML += `Error: Failed to validate known values<br/>`
                                throw new Error(`Validation is not working`)
                        }
                }
@@ -213,7 +212,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        logger.isEnabled = debug
                        const type = api
                        api = type.toLowerCase()
-                       selfCheck(api, debug)
+                       await selfCheck(api, debug)
                        Cache.clear()
                        logger.log(`%cNanoPow ${type}`, 'color:green', `Calculate truncated harmonic mean of the truncated arithmetic rate of generating proof-of-work across ${runs} runs of ${size} samples.`)
                        const rates = []
@@ -243,7 +242,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        logger.log(rates)
                        logger.log(results)
                        document.getElementById('output').innerHTML += `<hr/>`
-                       document.getElementById('summary').innerHTML += `work-per-second: ${truncatedHarmonic}<br/>`
+                       document.getElementById('summary').innerHTML += `Final work-per-second: ${truncatedHarmonic}<br/>`
                        document.getElementById('status').innerHTML = `TESTING COMPLETE<br/>`
                        logger.log('%TESTING COMPLETE', 'color:orange;font-weight:bold')
                }