Browse Source

ECPair: no elseif needed, move default for clarity

hk-custom-address
Daniel Cousens 9 years ago
parent
commit
ea4ce4e2a6
  1. 6
      src/ecpair.js

6
src/ecpair.js

@ -58,7 +58,6 @@ ECPair.fromPublicKeyBuffer = function (buffer, network) {
} }
ECPair.fromWIF = function (string, network) { ECPair.fromWIF = function (string, network) {
network = network || NETWORKS.bitcoin
var decoded = wif.decode(string) var decoded = wif.decode(string)
var version = decoded.version var version = decoded.version
@ -71,8 +70,9 @@ ECPair.fromWIF = function (string, network) {
if (!network) throw new Error('Unknown network version') if (!network) throw new Error('Unknown network version')
// network // network
} else if (network) { } else {
// check version only if defined network = network || NETWORKS.bitcoin
if (version !== network.wif) throw new Error('Invalid network version') if (version !== network.wif) throw new Error('Invalid network version')
} }

Loading…
Cancel
Save