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);