keyring: do not listen for all types of addrs.

This commit is contained in:
Christopher Jeffrey 2016-08-15 08:10:00 -07:00
parent 7f936ade4d
commit 989aa15a4c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 3 additions and 15 deletions

View File

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

View File

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