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 {