From: Chris Duncan Date: Fri, 10 Jul 2026 15:03:28 +0000 (-0700) Subject: Add a couple test scenarios and output sourcemap for debugging. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=a7e1d550a00c19b49584702c83fbd0e416c0b170;p=nano-pow.git Add a couple test scenarios and output sourcemap for debugging. --- diff --git a/esbuild.mjs b/esbuild.mjs index bf309e3..2f8a945 100644 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -16,6 +16,7 @@ const sharedOptions = { }, legalComments: 'inline', dropLabels: process.env.NODE_ENV === 'development' ? [] : ['LOG'], + sourcemap: 'linked', plugins: [ glsl({ minify: true, diff --git a/test/blockhashes.txt b/test/blockhashes.txt index d41c84b..f48238c 100644 --- a/test/blockhashes.txt +++ b/test/blockhashes.txt @@ -1,5 +1,6 @@ 92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D 92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D +92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40 0000000000000000000000000000000000000000000000000000000000000000 badhash 8797585D56B8AEA3A62899C31FC088F9BE849BA8298A88E94F6E3112D4E55D01 diff --git a/test/index.html b/test/index.html index 34a62c1..fce464e 100644 --- a/test/index.html +++ b/test/index.html @@ -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) }