diff --git a/lib/bcoin/block.js b/lib/bcoin/block.js index c5291f88..b9d4571d 100644 --- a/lib/bcoin/block.js +++ b/lib/bcoin/block.js @@ -339,16 +339,15 @@ Block.prototype.__defineGetter__('commitmentHash', function() { commitment = coinbase.outputs[i].script; if (commitment.isCommitment()) { commitmentHash = commitment.getCommitmentHash(); + commitmentHash = commitmentHash.toString('hex'); break; } } - if (!this.mutable) { - if (commitmentHash) - this._commitmentHash = commitmentHash.toString('hex'); - } + if (!this.mutable) + this._commitmentHash = commitmentHash; - return this._commitmentHash; + return commitmentHash; }); /** diff --git a/lib/bcoin/miner.js b/lib/bcoin/miner.js index c571328c..19be189c 100644 --- a/lib/bcoin/miner.js +++ b/lib/bcoin/miner.js @@ -100,13 +100,15 @@ Miner.prototype._init = function _init() { this.mempool.on('tx', function(tx) { if (!self.running) return; - self.attempt.addTX(tx); + if (self.attempt) + self.attempt.addTX(tx); }); } else if (this.pool) { this.pool.on('tx', function(tx) { if (!self.running) return; - self.attempt.addTX(tx); + if (self.attempt) + self.attempt.addTX(tx); }); }