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() {
|
KeyRing.prototype.getAddressMap = function getAddressMap() {
|
||||||
if (!this._addressMap) {
|
if (!this._addressMap) {
|
||||||
this._addressMap = {};
|
this._addressMap = {};
|
||||||
|
this._addressMap[this.getHash('hex')] = true;
|
||||||
this._addressMap[this.getKeyHash('hex')] = true;
|
|
||||||
|
|
||||||
if (this.type === KeyRing.types.MULTISIG)
|
|
||||||
this._addressMap[this.getScriptHash('hex')] = true;
|
|
||||||
|
|
||||||
if (this.witness)
|
if (this.witness)
|
||||||
this._addressMap[this.getProgramHash('hex')] = true;
|
this._addressMap[this.getProgramHash('hex')] = true;
|
||||||
}
|
}
|
||||||
@ -766,8 +761,7 @@ KeyRing.prototype.toJSON = function toJSON() {
|
|||||||
keys: this.keys.map(function(key) {
|
keys: this.keys.map(function(key) {
|
||||||
return key.toString('hex');
|
return key.toString('hex');
|
||||||
}),
|
}),
|
||||||
keyAddress: this.getKeyAddress('base58'),
|
address: this.getAddress('base58'),
|
||||||
scriptAddress: this.getScriptAddress('base58'),
|
|
||||||
programAddress: this.getProgramAddress('base58')
|
programAddress: this.getProgramAddress('base58')
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -820,17 +820,11 @@ WalletDB.prototype.saveAddress = function saveAddress(wid, addresses, callback)
|
|||||||
var batch = this.batch(wid);
|
var batch = this.batch(wid);
|
||||||
var i, address, path;
|
var i, address, path;
|
||||||
|
|
||||||
if (!Array.isArray(addresses))
|
|
||||||
addresses = [addresses];
|
|
||||||
|
|
||||||
for (i = 0; i < addresses.length; i++) {
|
for (i = 0; i < addresses.length; i++) {
|
||||||
address = addresses[i];
|
address = addresses[i];
|
||||||
path = Path.fromKeyRing(address);
|
path = Path.fromKeyRing(address);
|
||||||
|
|
||||||
items.push([address.getKeyAddress(), path]);
|
items.push([address.getAddress(), path]);
|
||||||
|
|
||||||
if (address.type === keyTypes.MULTISIG)
|
|
||||||
items.push([address.getScriptAddress(), path]);
|
|
||||||
|
|
||||||
if (address.witness)
|
if (address.witness)
|
||||||
items.push([address.getProgramAddress(), path]);
|
items.push([address.getProgramAddress(), path]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user