]> zoso.dev Git - nano-pow.git/commitdiff
Remove logging from CPU version since it would generate way too much information...
authorChris Duncan <chris@zoso.dev>
Tue, 4 Mar 2025 01:51:48 +0000 (17:51 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 4 Mar 2025 01:51:48 +0000 (17:51 -0800)
src/classes/cpu.ts

index 55e6d24427aabd3fe30e6c7fbc71d9f39d5fe263..d3690bbb2994e3312e7afb94ce0b238d65da4370 100644 (file)
@@ -113,7 +113,6 @@ export class NanoPowCpu {
        }
 
        static #hash (seed: bigint, hash: string): bigint {
-               if (this.#debug) console.log(`hash: ${hash}`)
                // Reset buffers before each calculation
                for (let i = 0; i < 8; i++) {
                        this.#v[i] = this.#blake2b_IV[i]
@@ -127,12 +126,10 @@ export class NanoPowCpu {
 
                // Set up input buffers
                this.#mView.setBigUint64(0, seed, true)
-               if (this.#debug) console.log(`seed: ${this.#m[0].toString(16).padStart(16, '0')} (${this.#m[0]})`)
                for (let i = 0; i < hash.length; i += 16) {
                        const u64 = hash.slice(i, i + 16)
                        this.#mView.setBigUint64(i / 2 + 8, BigInt(`0x${u64}`))
                }
-               if (this.#debug) console.log('m', this.#m)
 
                for (let r = 0; r < 12; r++) {
                        const s = this.#blake2b_sigma[r]
@@ -181,7 +178,6 @@ export class NanoPowCpu {
                        const random1 = Math.floor(Math.random() * 0xffffffff)
                        nonce = (BigInt(random0) << 32n) | BigInt(random1)
                        result = this.#hash(nonce, hash)
-                       if (attempts % 1000000n === 0n) console.log(`${attempts} attempts`)
                } while (result < threshold)
                console.log(performance.now() - start)
                this.#busy = false