From 007ebe9e4c022008562c11f951b693cd5e6f8a90 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 22 Jun 2026 15:18:49 -0700 Subject: [PATCH] Use generic strict equality hash comparison on cache functions to allow string or bigint comparisons. --- src/utils/cache.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 0d3b643..0490a6a 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -28,22 +28,22 @@ export const Cache = { clear (): void { storage.removeItem(STORAGE_KEY) }, - delete (hash: bigint): void { + delete (hash: unknown): void { const item = storage.getItem(STORAGE_KEY) if (item == null) return const cache = JSON.parse(item) as WorkGenerateResponse[] for (let i = 0; i < cache.length; i++) { - if (eq(cache[i].hash, hash)) { + if (cache[i].hash === hash) { cache.splice(i, 1) } } storage.setItem(STORAGE_KEY, JSON.stringify(cache)) }, - search (hash: bigint, difficulty: bigint): WorkGenerateResponse | null { + search (hash: unknown, difficulty: bigint): WorkGenerateResponse | null { const item = storage.getItem(STORAGE_KEY) if (item == null) return null const cache: WorkGenerateResponse[] = JSON.parse(item) - const match = cache.find(c => eq(c.hash, hash) && eq(c.difficulty, difficulty)) + const match = cache.find(c => c.hash === hash && eq(c.difficulty, difficulty)) return match ?? null }, store (result: WorkGenerateResponse): WorkGenerateResponse { -- 2.52.0