]> git.codecow.com Git - nano-pow.git/commitdiff
Add a couple test scenarios and output sourcemap for debugging.
authorChris Duncan <chris@codecow.com>
Fri, 10 Jul 2026 15:03:28 +0000 (08:03 -0700)
committerChris Duncan <chris@codecow.com>
Fri, 10 Jul 2026 15:03:28 +0000 (08:03 -0700)
esbuild.mjs
test/blockhashes.txt
test/index.html

index bf309e351c9efe6cf0d74bd659febe48c100150e..2f8a945d0b5e3c8ad1ff2ec3c1d7ef1124e06e8e 100644 (file)
@@ -16,6 +16,7 @@ const sharedOptions = {
        },
        legalComments: 'inline',
        dropLabels: process.env.NODE_ENV === 'development' ? [] : ['LOG'],
+       sourcemap: 'linked',
        plugins: [
                glsl({
                        minify: true,
index d41c84bcaca54094fd22f9e7d01cd3f87a90b2c3..f48238c96fe90956c576bd3d5874a22ded290521 100644 (file)
@@ -1,5 +1,6 @@
 92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D
 92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D
+92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40
 0000000000000000000000000000000000000000000000000000000000000000
 badhash
 8797585D56B8AEA3A62899C31FC088F9BE849BA8298A88E94F6E3112D4E55D01
index 34a62c1ec6989840b9ff99f2a27e25bab9c8a227..fce464e6370baa510e227447d071f40de7161717 100644 (file)
@@ -140,10 +140,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                expect.push(result)
 
                                const prefixes = [
+                                       'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
                                        '0Xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
                                        '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
                                        ' 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
                                        ' ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn ',
+                                       'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
                                ]
                                for (let i = 0; i < prefixes.length; i++) {
                                        const hash = prefixes[i]
@@ -159,7 +161,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                        }
                                        const end = performance.now()
                                        const check = await NanoPow.work_validate(result.work, result.hash, { difficulty, debug: isDebug })
-                                       const isValid = (check.valid === '1' && BigInt(`0x${result.hash}`) === BigInt(hash.replace('n', '').replace(' f', '0xf')))
+                                       const isValid = (check.valid === '1' && BigInt(`0x${result.hash}`) === BigInt(`0x${hash.trim().replace('n', '').replace(/^0x/i, '')}`))
                                        console.log(`work_generate() output for max value block hash is ${isValid === true ? 'correct' : 'incorrect'}`)
                                        expect.push(isValid)
                                }