pool: fix spv.
This commit is contained in:
parent
08b41a2dc4
commit
7a5f4a1928
@ -1830,7 +1830,7 @@ Pool.prototype._handleTX = co(function* handleTX(peer, packet) {
|
|||||||
if (peer.merkleBlock.hasTX(tx)) {
|
if (peer.merkleBlock.hasTX(tx)) {
|
||||||
peer.merkleBlock.addTX(tx);
|
peer.merkleBlock.addTX(tx);
|
||||||
if (--peer.merkleMatches === 0) {
|
if (--peer.merkleMatches === 0) {
|
||||||
yield this.addBlock(peer, peer.merkleBlock);
|
yield this._addBlock(peer, peer.merkleBlock);
|
||||||
peer.merkleTime = -1;
|
peer.merkleTime = -1;
|
||||||
peer.merkleBlock = null;
|
peer.merkleBlock = null;
|
||||||
peer.merkleMatches = 0;
|
peer.merkleMatches = 0;
|
||||||
@ -1993,6 +1993,22 @@ Pool.prototype.handleFilterClear = co(function* handleFilterClear(peer, packet)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Pool.prototype.handleMerkleBlock = co(function* handleMerkleBlock(peer, packet) {
|
Pool.prototype.handleMerkleBlock = co(function* handleMerkleBlock(peer, packet) {
|
||||||
|
var unlock = yield this.locker.lock();
|
||||||
|
try {
|
||||||
|
return yield this._handleMerkleBlock(peer, packet);
|
||||||
|
} finally {
|
||||||
|
unlock();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle `merkleblock` packet (without a lock).
|
||||||
|
* @private
|
||||||
|
* @param {Peer} peer
|
||||||
|
* @param {MerkleBlockPacket} block
|
||||||
|
*/
|
||||||
|
|
||||||
|
Pool.prototype._handleMerkleBlock = co(function* handleMerkleBlock(peer, packet) {
|
||||||
var block = packet.block;
|
var block = packet.block;
|
||||||
var hash = block.hash('hex');
|
var hash = block.hash('hex');
|
||||||
|
|
||||||
@ -2033,7 +2049,7 @@ Pool.prototype.handleMerkleBlock = co(function* handleMerkleBlock(peer, packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (block.matches.length === 0) {
|
if (block.matches.length === 0) {
|
||||||
yield this.addBlock(peer, block);
|
yield this._addBlock(peer, block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user