diff --git a/lib/mining/cpuminer.js b/lib/mining/cpuminer.js index a869f0d6..f36f42f6 100644 --- a/lib/mining/cpuminer.js +++ b/lib/mining/cpuminer.js @@ -528,13 +528,14 @@ CPUJob.prototype.destroy = function destroy() { }; /** - * Calculate number of hashes. + * Calculate number of hashes computed. * @param {Number} nonce * @returns {Number} */ CPUJob.prototype.getHashes = function getHashes(nonce) { - return this.nonce1 * 0x100000000 + this.nonce2 + nonce; + var extra = this.nonce1 * 0x100000000 + this.nonce2; + return extra * 0xffffffff + nonce; }; /** @@ -545,7 +546,8 @@ CPUJob.prototype.getHashes = function getHashes(nonce) { CPUJob.prototype.getRate = function getRate(nonce) { var hashes = this.getHashes(nonce); - return Math.floor(hashes / (util.now() - this.start)); + var seconds = util.now() - this.start; + return Math.floor(hashes / seconds); }; /**