cpuminer: fix getHashes.

This commit is contained in:
Christopher Jeffrey 2017-03-16 14:30:49 -07:00
parent 16dbde4978
commit 8453c250dc
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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);
};
/**