use adjusted time for mining.
This commit is contained in:
parent
6d7e81080e
commit
4cfc0daaad
@ -217,7 +217,7 @@ Miner.prototype.stop = function stop() {
|
||||
|
||||
Miner.prototype.createBlock = function createBlock(callback) {
|
||||
var self = this;
|
||||
var ts = Math.max(utils.now(), this.chain.tip.ts + 1);
|
||||
var ts = Math.max(bcoin.now(), this.chain.tip.ts + 1);
|
||||
var attempt;
|
||||
|
||||
if (!this.loaded) {
|
||||
@ -370,7 +370,7 @@ function MinerBlock(options) {
|
||||
version: options.version,
|
||||
prevBlock: this.tip.hash,
|
||||
merkleRoot: constants.NULL_HASH,
|
||||
ts: Math.max(utils.now(), this.tip.ts + 1),
|
||||
ts: Math.max(bcoin.now(), this.tip.ts + 1),
|
||||
bits: options.target,
|
||||
nonce: 0,
|
||||
height: this.height
|
||||
@ -429,7 +429,7 @@ MinerBlock.prototype.updateMerkle = function updateMerkle() {
|
||||
if (this.witness)
|
||||
this.updateCommitment();
|
||||
|
||||
this.block.ts = Math.max(utils.now(), this.tip.ts + 1);
|
||||
this.block.ts = Math.max(bcoin.now(), this.tip.ts + 1);
|
||||
this.block.merkleRoot = this.block.getMerkleRoot('hex');
|
||||
};
|
||||
|
||||
@ -516,7 +516,7 @@ MinerBlock.prototype.findNonce = function findNonce() {
|
||||
// update the timestamp. This improves
|
||||
// performance because we do not have to
|
||||
// recalculate the merkle root.
|
||||
now = utils.now();
|
||||
now = bcoin.now();
|
||||
if (now > block.ts && now > tip.ts) {
|
||||
block.ts = now;
|
||||
// Overflow the nonce
|
||||
|
||||
Loading…
Reference in New Issue
Block a user