]> git.codecow.com Git - nano-pow.git/commitdiff
Test initial cpu generate result instead of discarding.
authorChris Duncan <chris@codecow.com>
Mon, 25 May 2026 05:28:15 +0000 (22:28 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 25 May 2026 05:28:15 +0000 (22:28 -0700)
src/lib/generate/cpu/index.ts

index eb932305bd506bf8fe0458388b92dbba2e06c2e2..7ebd738003a2860fde4751547a43349f1ac057c5 100644 (file)
@@ -16,8 +16,8 @@ export async function generate (hash: Bytes, difficulty: bigint, debug: boolean)
                                LOG: logger.log('check 0x8000 nonces')
                                let result = NanoPowValidate(crypto.getRandomValues(new Uint8Array(8)), hash, difficulty, false)
                                for (let i = 0; i < 0x8000; i++) {
-                                       result = NanoPowValidate(crypto.getRandomValues(new Uint8Array(8)), hash, difficulty, false)
                                        if (result.valid === '1') break
+                                       result = NanoPowValidate(crypto.getRandomValues(new Uint8Array(8)), hash, difficulty, false)
                                }
                                if (result.valid === '1') {
                                        LOG: logger.groupEnd('NanoPow CPU work_generate')