From ed76063d9d9759d406033cdd593e1f28b76f0d22 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 22 Apr 2025 07:10:53 -0700 Subject: [PATCH] Fix threshold check when high bits are equal to difficulty and low bits must be checked. --- src/lib/gpu/compute.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1