From c61dd4caa265dde0a3c9789ad20a94f22a90696b Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Mon, 3 Oct 2022 08:32:11 +1100 Subject: [PATCH] No need to div/multiply --- haproxy/js/challenge.js | 2 +- haproxy/js/worker.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/haproxy/js/challenge.js b/haproxy/js/challenge.js index 3dc84a2..8ba602d 100644 --- a/haproxy/js/challenge.js +++ b/haproxy/js/challenge.js @@ -85,7 +85,7 @@ const powFinished = new Promise((resolve, reject) => { let finished = false; const messageHandler = (e) => { if (e.data.length === 1) { - const totalHashes = e.data[0]*workerThreads; //assumes all worker threads are same speed + const totalHashes = e.data[0]; //assumes all worker threads are same speed const elapsedSec = Math.floor((Date.now()-start)/1000); const hps = Math.floor(totalHashes/elapsedSec); const requiredSec = Math.floor(eHashes/hps) * 1.5; //estimate 1.5x time diff --git a/haproxy/js/worker.js b/haproxy/js/worker.js index 66ff2f6..6fd4617 100644 --- a/haproxy/js/worker.js +++ b/haproxy/js/worker.js @@ -6,7 +6,7 @@ onmessage = async function(e) { let i = id; if (id === 0) { setInterval(() => { - postMessage([i/threads]); + postMessage([i]); }, 500); } while(true) {