pool: fix broadcast items... again.
This commit is contained in:
parent
56aca55b1e
commit
97c89303ba
@ -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;
|
||||
};
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user