fix commit hash caching. fix miner race conditon.
This commit is contained in:
parent
b0c36d51dc
commit
a09c7365aa
@ -339,16 +339,15 @@ Block.prototype.__defineGetter__('commitmentHash', function() {
|
|||||||
commitment = coinbase.outputs[i].script;
|
commitment = coinbase.outputs[i].script;
|
||||||
if (commitment.isCommitment()) {
|
if (commitment.isCommitment()) {
|
||||||
commitmentHash = commitment.getCommitmentHash();
|
commitmentHash = commitment.getCommitmentHash();
|
||||||
|
commitmentHash = commitmentHash.toString('hex');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.mutable) {
|
if (!this.mutable)
|
||||||
if (commitmentHash)
|
this._commitmentHash = commitmentHash;
|
||||||
this._commitmentHash = commitmentHash.toString('hex');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._commitmentHash;
|
return commitmentHash;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -100,13 +100,15 @@ Miner.prototype._init = function _init() {
|
|||||||
this.mempool.on('tx', function(tx) {
|
this.mempool.on('tx', function(tx) {
|
||||||
if (!self.running)
|
if (!self.running)
|
||||||
return;
|
return;
|
||||||
self.attempt.addTX(tx);
|
if (self.attempt)
|
||||||
|
self.attempt.addTX(tx);
|
||||||
});
|
});
|
||||||
} else if (this.pool) {
|
} else if (this.pool) {
|
||||||
this.pool.on('tx', function(tx) {
|
this.pool.on('tx', function(tx) {
|
||||||
if (!self.running)
|
if (!self.running)
|
||||||
return;
|
return;
|
||||||
self.attempt.addTX(tx);
|
if (self.attempt)
|
||||||
|
self.attempt.addTX(tx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user