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) {
|
Miner.prototype.createBlock = function createBlock(callback) {
|
||||||
var self = this;
|
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;
|
var attempt;
|
||||||
|
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
@ -370,7 +370,7 @@ function MinerBlock(options) {
|
|||||||
version: options.version,
|
version: options.version,
|
||||||
prevBlock: this.tip.hash,
|
prevBlock: this.tip.hash,
|
||||||
merkleRoot: constants.NULL_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,
|
bits: options.target,
|
||||||
nonce: 0,
|
nonce: 0,
|
||||||
height: this.height
|
height: this.height
|
||||||
@ -429,7 +429,7 @@ MinerBlock.prototype.updateMerkle = function updateMerkle() {
|
|||||||
if (this.witness)
|
if (this.witness)
|
||||||
this.updateCommitment();
|
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');
|
this.block.merkleRoot = this.block.getMerkleRoot('hex');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ MinerBlock.prototype.findNonce = function findNonce() {
|
|||||||
// update the timestamp. This improves
|
// update the timestamp. This improves
|
||||||
// performance because we do not have to
|
// performance because we do not have to
|
||||||
// recalculate the merkle root.
|
// recalculate the merkle root.
|
||||||
now = utils.now();
|
now = bcoin.now();
|
||||||
if (now > block.ts && now > tip.ts) {
|
if (now > block.ts && now > tip.ts) {
|
||||||
block.ts = now;
|
block.ts = now;
|
||||||
// Overflow the nonce
|
// Overflow the nonce
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user