Renames network parameter to netstr

This should make the intent clearer.
This commit also catches the `null` case for the seed parameter.
This commit is contained in:
Daniel Cousens 2014-04-17 06:09:45 +10:00
parent bc05828fbc
commit a4ab75d560

View file

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