miner: use next deployment state for flags.

This commit is contained in:
Christopher Jeffrey 2017-03-13 20:54:33 -07:00
parent 5b3ca8ce6f
commit ef07c52fc6
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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