From a7a7999e3f10b4b4b1fc3fa2b30256d534bab458 Mon Sep 17 00:00:00 2001 From: Wei Lu Date: Sat, 15 Mar 2014 10:18:59 +0800 Subject: [PATCH] fix Wallet default constructor --- src/wallet.js | 2 +- test/wallet.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wallet.js b/src/wallet.js index 640576d..6e579ec 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -34,7 +34,7 @@ var Wallet = function (seed, options) { this.newMasterKey = function(seed, network) { if (!seed) { var seed= new Array(32); - rng.nextBytes(seedBytes); + rng.nextBytes(seed); } masterkey = new HDNode(seed, network); } diff --git a/test/wallet.js b/test/wallet.js index 176be26..b1a1579 100644 --- a/test/wallet.js +++ b/test/wallet.js @@ -39,6 +39,13 @@ describe('Wallet', function() { assert.equal(account.depth, 2) }) + describe('when seed is not specified', function(){ + it('generates a seed', function(){ + var wallet = new Wallet() + assert.ok(wallet.getMasterKey()) + }) + }) + describe('constructor options', function() { var wallet; beforeEach(function() {