Wallet: use indexOf explicitly over include*
This commit is contained in:
parent
2386253ea0
commit
4bb7f5b56d
1 changed files with 3 additions and 7 deletions
|
@ -137,13 +137,13 @@ Wallet.prototype.getPrivateKey = function(index) {
|
|||
}
|
||||
|
||||
Wallet.prototype.getPrivateKeyForAddress = function(address) {
|
||||
if (includeAddress(this.addresses, address)) {
|
||||
if (this.addresses.indexOf(address) > -1) {
|
||||
var index = this.addresses.indexOf(address)
|
||||
|
||||
return this.getPrivateKey(index)
|
||||
}
|
||||
|
||||
if (includeAddress(this.changeAddresses, address)) {
|
||||
if (this.changeAddresses.indexOf(address) > -1) {
|
||||
var index = this.changeAddresses.indexOf(address)
|
||||
|
||||
return this.getInternalPrivateKey(index)
|
||||
|
@ -266,7 +266,7 @@ function processTx(tx, isPending) {
|
|||
}
|
||||
|
||||
var myAddresses = this.addresses.concat(this.changeAddresses)
|
||||
if (includeAddress(myAddresses, address)) {
|
||||
if (myAddresses.indexOf(address) > -1) {
|
||||
var output = txid + ':' + i
|
||||
|
||||
this.outputs[output] = {
|
||||
|
@ -297,8 +297,4 @@ function processTx(tx, isPending) {
|
|||
}, this)
|
||||
}
|
||||
|
||||
function includeAddress(addresses, address) {
|
||||
return addresses.indexOf(address) > -1
|
||||
}
|
||||
|
||||
module.exports = Wallet
|
||||
|
|
Loading…
Reference in a new issue