Browse Source

fix Wallet default constructor

hk-custom-address
Wei Lu 11 years ago
parent
commit
a7a7999e3f
  1. 2
      src/wallet.js
  2. 7
      test/wallet.js

2
src/wallet.js

@ -34,7 +34,7 @@ var Wallet = function (seed, options) {
this.newMasterKey = function(seed, network) { this.newMasterKey = function(seed, network) {
if (!seed) { if (!seed) {
var seed= new Array(32); var seed= new Array(32);
rng.nextBytes(seedBytes); rng.nextBytes(seed);
} }
masterkey = new HDNode(seed, network); masterkey = new HDNode(seed, network);
} }

7
test/wallet.js

@ -39,6 +39,13 @@ describe('Wallet', function() {
assert.equal(account.depth, 2) 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() { describe('constructor options', function() {
var wallet; var wallet;
beforeEach(function() { beforeEach(function() {

Loading…
Cancel
Save