From: Chris Duncan Date: Tue, 22 Apr 2025 14:10:53 +0000 (-0700) Subject: Fix threshold check when high bits are equal to difficulty and low bits must be checked. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=ed76063d9d9759d406033cdd593e1f28b76f0d22;p=nano-pow.git Fix threshold check when high bits are equal to difficulty and low bits must be checked. --- diff --git a/src/lib/gpu/compute.wgsl b/src/lib/gpu/compute.wgsl index 9c46abe..17d2298 100644 --- a/src/lib/gpu/compute.wgsl +++ b/src/lib/gpu/compute.wgsl @@ -571,7 +571,7 @@ fn main(id: vec3, validate: bool) { * Set nonce if it passes the difficulty threshold and no other thread has set it. */ var result: vec2 = 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;