keyring: do not listen for all types of addrs.
This commit is contained in:
parent
7f936ade4d
commit
989aa15a4c
@ -542,12 +542,7 @@ KeyRing.prototype.getAddress = function getAddress(enc) {
|
||||
KeyRing.prototype.getAddressMap = function getAddressMap() {
|
||||
if (!this._addressMap) {
|
||||
this._addressMap = {};
|
||||
|
||||
this._addressMap[this.getKeyHash('hex')] = true;
|
||||
|
||||
if (this.type === KeyRing.types.MULTISIG)
|
||||
this._addressMap[this.getScriptHash('hex')] = true;
|
||||
|
||||
this._addressMap[this.getHash('hex')] = true;
|
||||
if (this.witness)
|
||||
this._addressMap[this.getProgramHash('hex')] = true;
|
||||
}
|
||||
@ -766,8 +761,7 @@ KeyRing.prototype.toJSON = function toJSON() {
|
||||
keys: this.keys.map(function(key) {
|
||||
return key.toString('hex');
|
||||
}),
|
||||
keyAddress: this.getKeyAddress('base58'),
|
||||
scriptAddress: this.getScriptAddress('base58'),
|
||||
address: this.getAddress('base58'),
|
||||
programAddress: this.getProgramAddress('base58')
|
||||
};
|
||||
};
|
||||
|
||||
@ -820,17 +820,11 @@ WalletDB.prototype.saveAddress = function saveAddress(wid, addresses, callback)
|
||||
var batch = this.batch(wid);
|
||||
var i, address, path;
|
||||
|
||||
if (!Array.isArray(addresses))
|
||||
addresses = [addresses];
|
||||
|
||||
for (i = 0; i < addresses.length; i++) {
|
||||
address = addresses[i];
|
||||
path = Path.fromKeyRing(address);
|
||||
|
||||
items.push([address.getKeyAddress(), path]);
|
||||
|
||||
if (address.type === keyTypes.MULTISIG)
|
||||
items.push([address.getScriptAddress(), path]);
|
||||
items.push([address.getAddress(), path]);
|
||||
|
||||
if (address.witness)
|
||||
items.push([address.getProgramAddress(), path]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user