From ef07c52fc60e66cbd927eeb32e04dbb0e93bb7b8 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 13 Mar 2017 20:54:33 -0700 Subject: [PATCH] miner: use next deployment state for flags. --- lib/mining/miner.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mining/miner.js b/lib/mining/miner.js index fd581984..790aa7c3 100644 --- a/lib/mining/miner.js +++ b/lib/mining/miner.js @@ -124,7 +124,7 @@ Miner.prototype.createBlock = co(function* createBlock(tip, address) { Miner.prototype._createBlock = co(function* createBlock(tip, address) { var version = this.options.version; - var ts, mtp, locktime, target, attempt, block; + var ts, mtp, locktime, target, attempt, block, state; if (!tip) tip = this.chain.tip; @@ -139,7 +139,9 @@ Miner.prototype._createBlock = co(function* createBlock(tip, address) { ts = Math.max(this.network.now(), mtp + 1); locktime = ts; - if (this.chain.state.hasMTP()) + state = yield this.chain.getDeployments(ts, tip); + + if (state.hasMTP()) locktime = mtp; target = yield this.chain.getTarget(ts, tip); @@ -152,10 +154,10 @@ Miner.prototype._createBlock = co(function* createBlock(tip, address) { bits: target, locktime: locktime, mtp: mtp, - flags: this.chain.state.flags, + flags: state.flags, address: address, coinbaseFlags: this.options.coinbaseFlags, - witness: this.chain.state.hasWitness(), + witness: state.hasWitness(), interval: this.network.halvingInterval, weight: this.options.reservedWeight, sigops: this.options.reservedSigops