sync on confirmations.
This commit is contained in:
parent
94f7bf000b
commit
a166450335
@ -117,6 +117,12 @@ WalletDB.prototype._init = function _init() {
|
|||||||
map.all.forEach(function(id) {
|
map.all.forEach(function(id) {
|
||||||
self.emit(id + ' confirmed', tx);
|
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) {
|
this.tx.on('unconfirmed', function(tx, map) {
|
||||||
@ -155,19 +161,7 @@ WalletDB.prototype._init = function _init() {
|
|||||||
if (err)
|
if (err)
|
||||||
return self.emit('error', err);
|
return self.emit('error', err);
|
||||||
|
|
||||||
// Only sync for confirmed txs.
|
self.emit('balances', balances, map);
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user