pool: fix broadcast items... again.

This commit is contained in:
Christopher Jeffrey 2016-10-06 02:07:53 -07:00
parent 56aca55b1e
commit 97c89303ba
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 5 additions and 9 deletions

View File

@ -1744,9 +1744,7 @@ Pool.prototype.broadcast = function broadcast(msg) {
}
return new Promise(function(resolve, reject) {
item.addCallback(function(err) {
resolve(err ? false : true);
});
item.addCallback(co.wrap(resolve, reject));
});
};
@ -2534,7 +2532,7 @@ BroadcastItem.prototype.ack = function ack(peer) {
self.emit('ack', peer);
for (i = 0; i < self.callback.length; i++)
self.callback[i]();
self.callback[i](null, true);
self.callback.length = 0;
}, 1000);
@ -2546,14 +2544,12 @@ BroadcastItem.prototype.ack = function ack(peer) {
*/
BroadcastItem.prototype.reject = function reject(peer) {
var i, err;
var i;
this.emit('reject', peer);
err = new Error('Rejected by ' + peer.hostname);
for (i = 0; i < this.callback.length; i++)
this.callback[i](err);
this.callback[i](null, false);
this.callback.length = 0;
};

View File

@ -221,7 +221,7 @@ Fullnode.prototype._init = function _init() {
});
this.miner.on('block', function(block) {
self.broadcast(block.toInv());
self.broadcast(block.toInv()).catch(onError);
});
this.walletdb.on('send', function(tx) {