ecpair/hdnode: fix network variable shadowing
This commit is contained in:
parent
c852372559
commit
91ff39d95a
2 changed files with 7 additions and 7 deletions
|
@ -61,15 +61,15 @@ ECPair.fromWIF = function (string, network) {
|
||||||
var decoded = wif.decode(string)
|
var decoded = wif.decode(string)
|
||||||
var version = decoded.version
|
var version = decoded.version
|
||||||
|
|
||||||
// [network, ...]
|
// list of networks?
|
||||||
if (types.Array(network)) {
|
if (types.Array(network)) {
|
||||||
network = network.filter(function (network) {
|
network = network.filter(function (x) {
|
||||||
return version === network.wif
|
return version === x.wif
|
||||||
}).pop()
|
}).pop()
|
||||||
|
|
||||||
if (!network) throw new Error('Unknown network version')
|
if (!network) throw new Error('Unknown network version')
|
||||||
|
|
||||||
// network
|
// otherwise, assume a network object (or default to bitcoin)
|
||||||
} else {
|
} else {
|
||||||
network = network || NETWORKS.bitcoin
|
network = network || NETWORKS.bitcoin
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,9 @@ HDNode.fromBase58 = function (string, networks) {
|
||||||
|
|
||||||
// list of networks?
|
// list of networks?
|
||||||
if (Array.isArray(networks)) {
|
if (Array.isArray(networks)) {
|
||||||
network = networks.filter(function (network) {
|
network = networks.filter(function (x) {
|
||||||
return version === network.bip32.private ||
|
return version === x.bip32.private ||
|
||||||
version === network.bip32.public
|
version === x.bip32.public
|
||||||
}).pop()
|
}).pop()
|
||||||
|
|
||||||
if (!network) throw new Error('Unknown network version')
|
if (!network) throw new Error('Unknown network version')
|
||||||
|
|
Loading…
Reference in a new issue