separated subscribeToAddresses from getAddressesInfo
This commit is contained in:
parent
9b8ecea1bd
commit
1f83f85189
3 changed files with 27 additions and 13 deletions
|
|
@ -1925,21 +1925,16 @@ Wallet.prototype.getAddressesStr = function(opts) {
|
|||
});
|
||||
};
|
||||
|
||||
Wallet.prototype.subscribeToAddresses = function() {
|
||||
var addrInfo = this.publicKeyRing.getAddressesInfo();
|
||||
this.blockchain.subscribe(_.pluck(addrInfo, 'addressStr'));
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc Alias for {@link PublicKeyRing#getAddressesInfo}
|
||||
*/
|
||||
Wallet.prototype.getAddressesInfo = function(opts) {
|
||||
var addrInfo = this.publicKeyRing.getAddressesInfo(opts, this.publicKey);
|
||||
var currentAddrs = this.blockchain.getSubscriptions();
|
||||
|
||||
var newAddrs = [];
|
||||
for (var i in addrInfo) {
|
||||
var a = addrInfo[i];
|
||||
if (!currentAddrs[a.addressStr] && !a.isChange)
|
||||
newAddrs.push(a.addressStr);
|
||||
}
|
||||
this.blockchain.subscribe(newAddrs);
|
||||
return addrInfo;
|
||||
return this.publicKeyRing.getAddressesInfo(opts, this.publicKey);
|
||||
};
|
||||
/**
|
||||
* @desc Returns true if a given address was generated by deriving our master public key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue