cpuminer: fix getHashes.
This commit is contained in:
parent
16dbde4978
commit
8453c250dc
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user