merkleblock/minerblock: fix hasTX calls.
This commit is contained in:
parent
45952a4140
commit
56ccfaa980
@ -62,7 +62,7 @@ exports.thresholdStates = {
|
||||
exports.flags = {
|
||||
VERIFY_NONE: 0,
|
||||
VERIFY_POW: 1 << 0,
|
||||
VERIFY_BODY: 1 << 1,
|
||||
VERIFY_BODY: 1 << 1
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user