sync on confirmations.

This commit is contained in:
Christopher Jeffrey 2016-04-08 17:58:59 -07:00
parent 94f7bf000b
commit a166450335
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

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