From a4ab75d560a43c293381049f517c2ea571448af7 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 17 Apr 2014 06:09:45 +1000 Subject: [PATCH] Renames network parameter to netstr This should make the intent clearer. This commit also catches the `null` case for the seed parameter. --- src/hdwallet.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hdwallet.js b/src/hdwallet.js index da2aa0c..7448b4e 100644 --- a/src/hdwallet.js +++ b/src/hdwallet.js @@ -16,12 +16,13 @@ function HmacSHA512(buffer, secret) { return convert.wordArrayToBytes(hash) } -function HDWallet(seed, network) { - if (seed === undefined) return; +function HDWallet(seed, netstr) { + if (seed == undefined) return; // FIXME: Boo, should be stricter var I = HmacSHA512(seed, 'Bitcoin seed') this.chaincode = I.slice(32) - this.network = network || 'bitcoin' + this.network = netstr || 'bitcoin' + if(!Network.hasOwnProperty(this.network)) { throw new Error("Unknown network: " + this.network) }