From ea4ce4e2a6b128365eb0d162608e15c92b732fec Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 27 Apr 2016 18:04:35 +1000 Subject: [PATCH] ECPair: no elseif needed, move default for clarity --- src/ecpair.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ecpair.js b/src/ecpair.js index ad06006..d608884 100644 --- a/src/ecpair.js +++ b/src/ecpair.js @@ -58,7 +58,6 @@ ECPair.fromPublicKeyBuffer = function (buffer, network) { } ECPair.fromWIF = function (string, network) { - network = network || NETWORKS.bitcoin var decoded = wif.decode(string) var version = decoded.version @@ -71,8 +70,9 @@ ECPair.fromWIF = function (string, network) { if (!network) throw new Error('Unknown network version') // network - } else if (network) { - // check version only if defined + } else { + network = network || NETWORKS.bitcoin + if (version !== network.wif) throw new Error('Invalid network version') }