From 24d9b2b2d8bf46d58dbc19bf1a182880cb37968e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 20 May 2014 04:08:57 -0500 Subject: [PATCH] pool: allow sending filterload to peers without an id to add to the bloom filter. --- lib/bcoin/pool.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 56bafde3..8a8e2baa 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -348,17 +348,19 @@ Pool.prototype.watch = function watch(id) { return; } - var hid = utils.toHex(id); - if (this.watchMap[hid]) - this.watchMap[hid]++; - else - this.watchMap[hid] = 1; + if (id) { + var hid = utils.toHex(id); + if (this.watchMap[hid]) + this.watchMap[hid]++; + else + this.watchMap[hid] = 1; - if (this.bloom.test(id, 'hex')) - return; + if (this.bloom.test(id, 'hex')) + return; - if (id) this.bloom.add(id, 'hex'); + } + if (this.peers.load) this.peers.load.updateWatch(); for (var i = 0; i < this.peers.block.length; i++)