From a1664503354d6901377b7972b539ec709a536e95 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 8 Apr 2016 17:58:59 -0700 Subject: [PATCH] sync on confirmations. --- lib/bcoin/walletdb.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/bcoin/walletdb.js b/lib/bcoin/walletdb.js index cab6dcab..a6738f7f 100644 --- a/lib/bcoin/walletdb.js +++ b/lib/bcoin/walletdb.js @@ -117,6 +117,12 @@ WalletDB.prototype._init = function _init() { map.all.forEach(function(id) { self.emit(id + ' confirmed', tx); }); + utils.forEachSerial(map.output, function(id, next) { + self.syncOutputDepth(id, tx, next); + }, function(err) { + if (err) + self.emit('error', err); + }); }); this.tx.on('unconfirmed', function(tx, map) { @@ -155,19 +161,7 @@ WalletDB.prototype._init = function _init() { if (err) return self.emit('error', err); - // Only sync for confirmed txs. - if (tx.ts === 0) { - self.emit('balances', balances, map); - return; - } - - utils.forEachSerial(map.output, function(id, next) { - self.syncOutputDepth(id, tx, next); - }, function(err) { - if (err) - self.emit('error', err); - self.emit('balances', balances, map); - }); + self.emit('balances', balances, map); }); }); };