Wallet: assign indexOf in the same step

This commit is contained in:
Daniel Cousens 2014-08-16 17:23:24 +10:00
parent 9620b68fe2
commit 897bbf4eb4

View file

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