Wallet: assign indexOf in the same step
This commit is contained in:
parent
9620b68fe2
commit
897bbf4eb4
1 changed files with 3 additions and 5 deletions
|
@ -181,15 +181,13 @@ Wallet.prototype.getPrivateKey = function(index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallet.prototype.getPrivateKeyForAddress = function(address) {
|
Wallet.prototype.getPrivateKeyForAddress = function(address) {
|
||||||
if (this.addresses.indexOf(address) > -1) {
|
var index
|
||||||
var index = this.addresses.indexOf(address)
|
|
||||||
|
|
||||||
|
if ((index = this.addresses.indexOf(address)) > -1) {
|
||||||
return this.getPrivateKey(index)
|
return this.getPrivateKey(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.changeAddresses.indexOf(address) > -1) {
|
if ((index = this.changeAddresses.indexOf(address)) > -1) {
|
||||||
var index = this.changeAddresses.indexOf(address)
|
|
||||||
|
|
||||||
return this.getInternalPrivateKey(index)
|
return this.getInternalPrivateKey(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue