Browse Source

Wallet: use indexOf explicitly over include*

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
4bb7f5b56d
  1. 10
      src/wallet.js

10
src/wallet.js

@ -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…
Cancel
Save