miner: wrap nonces correctly.

This commit is contained in:
Christopher Jeffrey 2017-01-13 16:44:46 -08:00
parent b77b814be4
commit 0f4348af6d
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -230,12 +230,13 @@ MinerBlock.prototype.updateNonce = function updateNonce() {
// Overflow the nonce and increment the extraNonce.
this.block.nonce = 0;
this.nonce1++;
this.nonce1 &= 0xffffffffffff;
if (this.nonce1 === 0)
// Wrap at 6 bytes.
if (this.nonce1 === 0xffffffffffff) {
this.nonce1 = 0;
this.nonce2++;
}
// We incremented the extraNonce, need to update coinbase.
this.updateCoinbase();