remove wallet.getPublicKeys().

This commit is contained in:
Christopher Jeffrey 2015-12-20 01:45:02 -08:00
parent 1db84a0528
commit a50ee3e0ba

View File

@ -129,9 +129,6 @@ Wallet.prototype._init = function init() {
}; };
Wallet.prototype.__defineGetter__('prefix', function() { Wallet.prototype.__defineGetter__('prefix', function() {
if (this.n !== this.keys.length)
throw new Error('Not enough keys to generate prefix');
return 'bt/' + this.getFullAddress() + '/'; return 'bt/' + this.getFullAddress() + '/';
}); });
@ -253,11 +250,12 @@ Wallet.prototype.getPrivateKey = function getPrivateKey(enc) {
Wallet.prototype.getFullPublicKey = function getFullPublicKey(enc) { Wallet.prototype.getFullPublicKey = function getFullPublicKey(enc) {
var pub = this.getOwnPublicKey(); var pub = this.getOwnPublicKey();
var keys;
if (this.type === 'scripthash') { if (this.type === 'scripthash') {
keys = this.getPublicKeys(); if (this.n !== this.keys.length)
pub = bcoin.script.encode(bcoin.script.multisig(keys, this.m, this.n)); 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') if (enc === 'base58')
@ -283,14 +281,6 @@ Wallet.prototype.getPublicKey = function getPublicKey(enc) {
return this.getFullPublicKey(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() { Wallet.prototype.getFullHash = function getFullHash() {
return Wallet.key2hash(this.getFullPublicKey()); return Wallet.key2hash(this.getFullPublicKey());
}; };
@ -383,7 +373,7 @@ Wallet.prototype.ownOutput = function ownOutput(tx, index) {
var scriptHash = this.getFullHash(); var scriptHash = this.getFullHash();
var hash = this.getOwnHash(); var hash = this.getOwnHash();
var key = this.getOwnPublicKey(); var key = this.getOwnPublicKey();
var keys = this.getPublicKeys(); var keys = this.keys;
var outputs = tx.outputs.filter(function(output, i) { var outputs = tx.outputs.filter(function(output, i) {
var s = output.script; var s = output.script;
@ -417,7 +407,7 @@ Wallet.prototype.ownInput = function ownInput(tx, index) {
var hash = this.getOwnHash(); var hash = this.getOwnHash();
var key = this.getOwnPublicKey(); var key = this.getOwnPublicKey();
var redeem = this.getFullPublicKey(); var redeem = this.getFullPublicKey();
var keys = this.getPublicKeys(); var keys = this.keys;
var inputs = tx.inputs.filter(function(input, i) { var inputs = tx.inputs.filter(function(input, i) {
var s; var s;