From 56ccfaa98028d2b5fa8a662c3b56f27a1624da76 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 28 Feb 2017 09:32:17 -0800 Subject: [PATCH] merkleblock/minerblock: fix hasTX calls. --- lib/blockchain/common.js | 2 +- lib/mining/minerblock.js | 3 ++- lib/net/pool.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index ca5f1eff..efb0ce55 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -62,7 +62,7 @@ exports.thresholdStates = { exports.flags = { VERIFY_NONE: 0, VERIFY_POW: 1 << 0, - VERIFY_BODY: 1 << 1, + VERIFY_BODY: 1 << 1 }; /** diff --git a/lib/mining/minerblock.js b/lib/mining/minerblock.js index a577857a..3eec53df 100644 --- a/lib/mining/minerblock.js +++ b/lib/mining/minerblock.js @@ -353,11 +353,12 @@ MinerBlock.prototype.extraNonce = function extraNonce() { */ MinerBlock.prototype.addTX = function addTX(tx, view) { + var hash = tx.hash('hex'); var item, weight, sigops; assert(!tx.mutable, 'Cannot add mutable TX to block.'); - if (this.block.hasTX(tx)) + if (this.block.hasTX(hash)) return false; item = BlockEntry.fromTX(tx, view, this); diff --git a/lib/net/pool.js b/lib/net/pool.js index a4f207c0..84fbf5f9 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -2153,7 +2153,7 @@ Pool.prototype._handleTX = co(function* handleTX(peer, packet) { if (peer.merkleBlock) { assert(peer.merkleMatches > 0); - if (peer.merkleBlock.hasTX(tx)) { + if (peer.merkleBlock.hasTX(hash)) { peer.merkleBlock.addTX(tx); if (--peer.merkleMatches === 0) { yield this._addBlock(peer, peer.merkleBlock, flags);