fix: do not throw on destroyed peers.

This commit is contained in:
Christopher Jeffrey 2014-06-06 06:37:47 -05:00
parent 28abd09845
commit 11b56e32d7

View File

@ -285,7 +285,9 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
peer.updateWatch();
self.tx.list.forEach(function(entry) {
peer.broadcast(entry.tx)[0].once('request', function() {
var result = peer.broadcast(entry.tx);
if (!result) return;
result[0].once('request', function() {
entry.e.emit('ack');
});
});
@ -703,7 +705,9 @@ Pool.prototype.sendTX = function sendTX(tx) {
this.tx.list.push(entry);
this.peers.block.forEach(function(peer) {
peer.broadcast(tx)[0].once('request', function() {
var result = peer.broadcast(tx);
if (!result) return;
result[0].once('request', function() {
e.emit('ack');
});
});