]> zoso.dev Git - nano-pow.git/commitdiff
Fix threshold check when high bits are equal to difficulty and low bits must be checked.
authorChris Duncan <chris@zoso.dev>
Tue, 22 Apr 2025 14:10:53 +0000 (07:10 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 22 Apr 2025 14:10:53 +0000 (07:10 -0700)
src/lib/gpu/compute.wgsl

index 9c46abe04bdcb64c7a305e01fa826a594f1b5e60..17d22984faebe69ff6f5c6d87e1f7d7c62382373 100644 (file)
@@ -571,7 +571,7 @@ fn main(id: vec3<u32>, validate: bool) {
        * Set nonce if it passes the difficulty threshold and no other thread has set it.
        */
        var result: vec2<u32> = BLAKE2B_INIT[0u] ^ v0 ^ v8;
-       if (validate || ((result.y > ubo.difficulty.y || (result.y == ubo.difficulty.y && result.y >= ubo.difficulty.y)) && atomicLoad(&work.found) == 0u)) {
+       if (validate || ((result.y > ubo.difficulty.y || (result.y == ubo.difficulty.y && result.x >= ubo.difficulty.x)) && atomicLoad(&work.found) == 0u)) {
                atomicStore(&work.found, 1u);
                work.nonce = m0;
                work.result = result;