From: Chris Duncan Date: Thu, 9 Apr 2026 21:31:27 +0000 (-0700) Subject: Refactor caching without utils import. Add duplicate block hash to test cache storage... X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=77858720c1269309d6f53c1f61a1cb06fc6e2b69;p=nano-pow.git Refactor caching without utils import. Add duplicate block hash to test cache storage and retrieval. --- diff --git a/src/lib/index.ts b/src/lib/index.ts index 13fffa1..938f8ad 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -15,7 +15,8 @@ export async function generate (hash: unknown, options?: unknown): Promise= difficulty) { + if (BigInt(`0x${c.hash}`) === hash && BigInt(`0x${c.difficulty}`) >= difficulty) { return c } } diff --git a/test/blockhashes.txt b/test/blockhashes.txt index ba54aaf..d41c84b 100644 --- a/test/blockhashes.txt +++ b/test/blockhashes.txt @@ -1,4 +1,5 @@ 92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D +92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D 0000000000000000000000000000000000000000000000000000000000000000 badhash 8797585D56B8AEA3A62899C31FC088F9BE849BA8298A88E94F6E3112D4E55D01