]> zoso.dev Git - libnemo.git/commitdiff
Remove console logging. Remove deprecated CPU-based pow code.
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 20:47:58 +0000 (12:47 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 20:47:58 +0000 (12:47 -0800)
src/lib/pow.ts

index 24489d44e254f4df78d1b5d6f2a71b1f78015bcb..1c67600eacf4154e756867133a799460e6fa180a 100644 (file)
@@ -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<void> {
-               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
        }
 
        /**