From a50ee3e0bab89ac139b1e283c008a5f37e68daa0 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 20 Dec 2015 01:45:02 -0800 Subject: [PATCH] remove wallet.getPublicKeys(). --- lib/bcoin/wallet.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 3394582d..fd01f76d 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -129,9 +129,6 @@ Wallet.prototype._init = function init() { }; Wallet.prototype.__defineGetter__('prefix', function() { - if (this.n !== this.keys.length) - throw new Error('Not enough keys to generate prefix'); - return 'bt/' + this.getFullAddress() + '/'; }); @@ -253,11 +250,12 @@ Wallet.prototype.getPrivateKey = function getPrivateKey(enc) { Wallet.prototype.getFullPublicKey = function getFullPublicKey(enc) { var pub = this.getOwnPublicKey(); - var keys; if (this.type === 'scripthash') { - keys = this.getPublicKeys(); - pub = bcoin.script.encode(bcoin.script.multisig(keys, this.m, this.n)); + if (this.n !== this.keys.length) + throw new Error('Not enough keys to generate address'); + + pub = bcoin.script.encode(bcoin.script.multisig(this.keys, this.m, this.n)); } if (enc === 'base58') @@ -283,14 +281,6 @@ Wallet.prototype.getPublicKey = function getPublicKey(enc) { return this.getFullPublicKey(enc); }; -Wallet.prototype.getPublicKeys = function getPublicKeys() { - var keys = this.keys.slice().map(utils.toKeyArray); - - keys = utils.sortKeys(keys); - - return keys; -}; - Wallet.prototype.getFullHash = function getFullHash() { return Wallet.key2hash(this.getFullPublicKey()); }; @@ -383,7 +373,7 @@ Wallet.prototype.ownOutput = function ownOutput(tx, index) { var scriptHash = this.getFullHash(); var hash = this.getOwnHash(); var key = this.getOwnPublicKey(); - var keys = this.getPublicKeys(); + var keys = this.keys; var outputs = tx.outputs.filter(function(output, i) { var s = output.script; @@ -417,7 +407,7 @@ Wallet.prototype.ownInput = function ownInput(tx, index) { var hash = this.getOwnHash(); var key = this.getOwnPublicKey(); var redeem = this.getFullPublicKey(); - var keys = this.getPublicKeys(); + var keys = this.keys; var inputs = tx.inputs.filter(function(input, i) { var s;