ignore change addresses
This commit is contained in:
parent
117dddc138
commit
cf8106eb3f
|
@ -71,9 +71,11 @@ BlockchainMonitor._handleIncommingTx = function(data) {
|
|||
if (_.isEmpty(outs)) return;
|
||||
|
||||
async.each(outs, function(out, next) {
|
||||
storage.fetchWalletIdByAddress(out.address, function(err, walletId) {
|
||||
if (err || !walletId) return next(err);
|
||||
storage.fetchAddress(out.address, function(err, address) {
|
||||
if (err || !address) return next(err);
|
||||
if (address.isChange) return next();
|
||||
|
||||
var walletId = address.walletId;
|
||||
log.info('Incoming tx for wallet ' + walletId + ' (' + out.address + ' -> ' + out.amount + ')');
|
||||
BlockchainMonitor._createNotification(walletId, data.txid, out.address, out.amount, next);
|
||||
});
|
||||
|
|
|
@ -312,7 +312,7 @@ Storage.prototype.storeAddressAndWallet = function(wallet, addresses, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
Storage.prototype.fetchWalletIdByAddress = function(address, cb) {
|
||||
Storage.prototype.fetchAddress = function(address, cb) {
|
||||
var self = this;
|
||||
|
||||
this.db.collection(collections.ADDRESSES).findOne({
|
||||
|
@ -321,7 +321,7 @@ Storage.prototype.fetchWalletIdByAddress = function(address, cb) {
|
|||
if (err) return cb(err);
|
||||
if (!result) return cb();
|
||||
|
||||
return cb(null, result.walletId);
|
||||
return cb(null, Model.Address.fromObj(result));
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue