diff --git a/src/wallet.js b/src/wallet.js index e596b66..29f124b 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -181,15 +181,13 @@ Wallet.prototype.getPrivateKey = function(index) { } Wallet.prototype.getPrivateKeyForAddress = function(address) { - if (this.addresses.indexOf(address) > -1) { - var index = this.addresses.indexOf(address) + var index + if ((index = this.addresses.indexOf(address)) > -1) { return this.getPrivateKey(index) } - if (this.changeAddresses.indexOf(address) > -1) { - var index = this.changeAddresses.indexOf(address) - + if ((index = this.changeAddresses.indexOf(address)) > -1) { return this.getInternalPrivateKey(index) }