update active addresses from bc monitor

This commit is contained in:
Ivan Socolsky 2015-12-14 17:30:28 -03:00
parent 4198d5c47c
commit 124742a792
1 changed files with 14 additions and 2 deletions

View File

@ -92,7 +92,7 @@ BlockchainMonitor.prototype._handleTxId = function(data, processIt) {
self.storage.fetchTxByHash(data.txid, function(err, txp) {
if (err) {
log.error('Could not fetch tx the db');
log.error('Could not fetch tx from the db');
return;
}
if (!txp || txp.status != 'accepted') return;
@ -164,13 +164,25 @@ BlockchainMonitor.prototype._handleTxOuts = function(data) {
},
walletId: walletId,
});
self._storeAndBroadcastNotification(notification, next);
self._updateActiveAddresses(address, function() {
self._storeAndBroadcastNotification(notification, next);
});
});
}, function(err) {
return;
});
};
BlockchainMonitor.prototype._updateActiveAddresses = function(address, cb) {
var self = this;
self.storage.storeActiveAddresses(address.walletId, address.address, function(err) {
if (err) {
log.warn('Could not update wallet cache', err);
}
return cb(err);
});
};
BlockchainMonitor.prototype._handleIncommingTx = function(data) {
this._handleTxId(data);