mirror of https://github.com/BTCPrivate/copay.git
Removed 'funds received' notification for change addresses
This commit is contained in:
parent
e2af5ac782
commit
e0263cf594
|
@ -710,7 +710,13 @@ Wallet.prototype._setBlockchainListeners = function() {
|
|||
});
|
||||
this.blockchain.on('tx', function(tx) {
|
||||
log.debug('blockchain tx event');
|
||||
self.emit('tx', tx.address);
|
||||
var addresses = self.getAddressesInfo();
|
||||
var addr = _.findWhere(addresses, {
|
||||
addressStr: tx.address
|
||||
});
|
||||
if (addr) {
|
||||
self.emit('tx', tx.address, addr.isChange);
|
||||
}
|
||||
});
|
||||
|
||||
if (!self.spendUnconfirmed) {
|
||||
|
@ -1403,10 +1409,9 @@ Wallet.prototype.receivePaymentRequest = function(options, pr, cb) {
|
|||
expires: expires,
|
||||
memo: memo || 'This server would like some BTC from you.',
|
||||
payment_url: payment_url,
|
||||
merchant_data: merchant_data
|
||||
? merchant_data.toString('hex')
|
||||
// : new Buffer('none', 'utf8').toString('hex')
|
||||
: '00'
|
||||
merchant_data: merchant_data ? merchant_data.toString('hex')
|
||||
// : new Buffer('none', 'utf8').toString('hex')
|
||||
: '00'
|
||||
},
|
||||
signature: sig.toString('hex'),
|
||||
ca: trust.caName,
|
||||
|
|
|
@ -69,8 +69,10 @@ angular.module('copayApp.services')
|
|||
}
|
||||
});
|
||||
|
||||
w.on('tx', function(address) {
|
||||
notification.funds('Funds received!', address);
|
||||
w.on('tx', function(address, isChange) {
|
||||
if (!isChange) {
|
||||
notification.funds('Funds received!', address);
|
||||
}
|
||||
root.updateBalance(function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
|
|
@ -1591,4 +1591,27 @@ describe('Wallet model', function() {
|
|||
should.exist(n.networkNonce);
|
||||
});
|
||||
|
||||
it('should emit notification when tx received', function(done) {
|
||||
var w = cachedCreateW2();
|
||||
w.blockchain.removeAllListeners = sinon.stub();
|
||||
var spy = sinon.spy(w, 'emit');
|
||||
|
||||
w.generateAddress(false, function(addr1) {
|
||||
w.generateAddress(true, function(addr2) {
|
||||
w.blockchain.on = sinon.stub().withArgs('tx').yields({
|
||||
address: addr1.toString(),
|
||||
});
|
||||
w._setBlockchainListeners();
|
||||
spy.calledWith('tx', addr1.toString(), false).should.be.true;
|
||||
|
||||
w.blockchain.on = sinon.stub().withArgs('tx').yields({
|
||||
address: addr2.toString(),
|
||||
});
|
||||
w._setBlockchainListeners();
|
||||
spy.calledWith('tx', addr2.toString(), true).should.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue