Browse Source

Renames network parameter to netstr

This should make the intent clearer.
This commit also catches the `null` case for the seed parameter.
hk-custom-address
Daniel Cousens 11 years ago
parent
commit
a4ab75d560
  1. 7
      src/hdwallet.js

7
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)
}

Loading…
Cancel
Save