From 47f75c9957e0424d4a84a426291096e7f00185db Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 2 Jun 2016 16:26:25 -0700 Subject: [PATCH] add all addresses to bloom filter. --- lib/bcoin/spvnode.js | 4 ++++ lib/bcoin/wallet.js | 6 +++--- lib/bcoin/walletdb.js | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/spvnode.js b/lib/bcoin/spvnode.js index e50951e7..0436dca0 100644 --- a/lib/bcoin/spvnode.js +++ b/lib/bcoin/spvnode.js @@ -123,6 +123,10 @@ SPVNode.prototype._init = function _init() { }); }); + this.walletdb.on('save address', function(hash) { + self.pool.watch(hash, 'hex'); + }); + function load(err) { if (err) return self.emit('error', err); diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 41bcdfba..1eb36b92 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -835,12 +835,12 @@ Wallet.prototype.syncOutputDepth = function syncOutputDepth(tx, callback) { if (!account) return next(); - account.setDepth(receiveDepth, changeDepth, function(err, rec, chng) { + account.setDepth(receiveDepth, changeDepth, function(err, rcv, chng) { if (err) return next(err); - if (rec) - receive.push(rec); + if (rcv) + receive.push(rcv); if (chng) change.push(chng); diff --git a/lib/bcoin/walletdb.js b/lib/bcoin/walletdb.js index 11434f02..74d19dd9 100644 --- a/lib/bcoin/walletdb.js +++ b/lib/bcoin/walletdb.js @@ -682,6 +682,8 @@ WalletDB.prototype.saveAddress = function saveAddress(id, addresses, callback) { if (self.tx.filter) self.tx.filter.add(hash[0], 'hex'); + self.emit('save address', hash[0], hash[1]); + self.db.fetch('W/' + hash[0], parsePaths, function(err, paths) { if (err) return next(err);