From 09a2dc0f55edeaa66d4747687d8a2d29dac4ed9d Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 14 Aug 2017 17:51:40 -0700 Subject: [PATCH] cpuminer: avoid division by zero. --- lib/mining/cpuminer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mining/cpuminer.js b/lib/mining/cpuminer.js index 6bb7cda5..3e39d2b5 100644 --- a/lib/mining/cpuminer.js +++ b/lib/mining/cpuminer.js @@ -547,7 +547,7 @@ CPUJob.prototype.getHashes = function getHashes(nonce) { CPUJob.prototype.getRate = function getRate(nonce) { const hashes = this.getHashes(nonce); const seconds = util.now() - this.start; - return Math.floor(hashes / seconds); + return Math.floor(hashes / Math.max(1, seconds)); }; /**