From: Chris Duncan Date: Tue, 3 Dec 2024 20:47:58 +0000 (-0800) Subject: Remove console logging. Remove deprecated CPU-based pow code. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=aca0ebf0463b57a5e9c142f9231a556fdd885df0;p=libnemo.git Remove console logging. Remove deprecated CPU-based pow code. --- diff --git a/src/lib/pow.ts b/src/lib/pow.ts index 24489d4..1c67600 100644 --- a/src/lib/pow.ts +++ b/src/lib/pow.ts @@ -19,7 +19,6 @@ const p = () => { postMessage(new ArrayBuffer(0)) } else { find(d.hash, d.threshold ?? SEND_THRESHOLD).then(nonce => { - console.log(`pow found: ${nonce}`) d.work = nonce const buf = new TextEncoder().encode(JSON.stringify(data)).buffer //@ts-expect-error @@ -30,26 +29,9 @@ const p = () => { }) async function find (hash: string, threshold: string = SEND_THRESHOLD): Promise { - console.log(`hash: ${hash}`) return new Promise(resolve => { - calculate(hash, resolve, console.log, threshold) + calculate(hash, resolve, undefined, threshold) }) - // let result = null - // let count = 0 - // do { - // count++ - // const nonce: Uint8Array = new Uint8Array(NONCE_BYTES) - // crypto.getRandomValues(nonce) - // const test: string = new Blake2b(NONCE_BYTES) - // .update(nonce) - // .update(parseHex(hash)) - // .digest('hex') as string - // if (count % 1000 === 0) console.log(`${count} hashes...`) - // if (BigInt(`0x${test}`) >= BigInt(`0x${threshold}`)) { - // result = nonce - // } - // } while (result == null) - // return result } /**