Browse Source

ignore change addresses

activeAddress
Ivan Socolsky 10 years ago
parent
commit
cf8106eb3f
  1. 6
      lib/blockchainmonitor.js
  2. 4
      lib/storage.js

6
lib/blockchainmonitor.js

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

4
lib/storage.js

@ -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…
Cancel
Save