]> zoso.dev Git - nano-pow.git/commitdiff
Throw error if nonce seed returned by compute shader does not match work to validate.
authorChris Duncan <chris@zoso.dev>
Tue, 22 Apr 2025 15:14:11 +0000 (08:14 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 22 Apr 2025 15:14:11 +0000 (08:14 -0700)
src/lib/gpu/index.ts

index 4cd24fd31338dca591f468cf53a1a29180de8756..abc432525aaabd1669f17a3b1d28ff5e3849b5c4 100644 (file)
@@ -355,6 +355,7 @@ export class NanoPowGpu {
                nonce = this.#resultView.getBigUint64(8, true)
                result = this.#resultView.getBigUint64(16, true)
                this.#busy = false
+               if (seed !== nonce) throw new Error('Result does not match work')
                if (this.#debug) console.log('nonce', nonce, nonce.toString(16).padStart(16, '0'))
                if (this.#debug) console.log('result', result, result.toString(16).padStart(16, '0'))
                const response: WorkValidateResponse = {