Browse Source

ecpair/hdnode: fix network variable shadowing

hk-custom-address
Daniel Cousens 8 years ago
committed by Daniel Cousens
parent
commit
91ff39d95a
  1. 8
      src/ecpair.js
  2. 6
      src/hdnode.js

8
src/ecpair.js

@ -61,15 +61,15 @@ ECPair.fromWIF = function (string, network) {
var decoded = wif.decode(string)
var version = decoded.version
// [network, ...]
// list of networks?
if (types.Array(network)) {
network = network.filter(function (network) {
return version === network.wif
network = network.filter(function (x) {
return version === x.wif
}).pop()
if (!network) throw new Error('Unknown network version')
// network
// otherwise, assume a network object (or default to bitcoin)
} else {
network = network || NETWORKS.bitcoin

6
src/hdnode.js

@ -61,9 +61,9 @@ HDNode.fromBase58 = function (string, networks) {
// list of networks?
if (Array.isArray(networks)) {
network = networks.filter(function (network) {
return version === network.bip32.private ||
version === network.bip32.public
network = networks.filter(function (x) {
return version === x.bip32.private ||
version === x.bip32.public
}).pop()
if (!network) throw new Error('Unknown network version')

Loading…
Cancel
Save