Wallet: use indexOf explicitly over include*

This commit is contained in:
Daniel Cousens 2014-08-16 17:15:13 +10:00
parent 2386253ea0
commit 4bb7f5b56d

View file

@ -137,13 +137,13 @@ Wallet.prototype.getPrivateKey = function(index) {
} }
Wallet.prototype.getPrivateKeyForAddress = function(address) { Wallet.prototype.getPrivateKeyForAddress = function(address) {
if (includeAddress(this.addresses, address)) { if (this.addresses.indexOf(address) > -1) {
var index = this.addresses.indexOf(address) var index = this.addresses.indexOf(address)
return this.getPrivateKey(index) return this.getPrivateKey(index)
} }
if (includeAddress(this.changeAddresses, address)) { if (this.changeAddresses.indexOf(address) > -1) {
var index = this.changeAddresses.indexOf(address) var index = this.changeAddresses.indexOf(address)
return this.getInternalPrivateKey(index) return this.getInternalPrivateKey(index)
@ -266,7 +266,7 @@ function processTx(tx, isPending) {
} }
var myAddresses = this.addresses.concat(this.changeAddresses) var myAddresses = this.addresses.concat(this.changeAddresses)
if (includeAddress(myAddresses, address)) { if (myAddresses.indexOf(address) > -1) {
var output = txid + ':' + i var output = txid + ':' + i
this.outputs[output] = { this.outputs[output] = {
@ -297,8 +297,4 @@ function processTx(tx, isPending) {
}, this) }, this)
} }
function includeAddress(addresses, address) {
return addresses.indexOf(address) > -1
}
module.exports = Wallet module.exports = Wallet