Browse Source

Wallet: enforce operator new

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
cde285ccfc
  1. 2
      src/wallet.js
  2. 4
      test/wallet.js

2
src/wallet.js

@ -6,8 +6,6 @@ var HDNode = require('./hdwallet')
var Transaction = require('./transaction').Transaction
function Wallet(seed, network) {
if (!(this instanceof Wallet)) { return new Wallet(seed, options); }
network = network || networks.bitcoin
// Stored in a closure to make accidental serialization less likely

4
test/wallet.js

@ -25,10 +25,6 @@ describe('Wallet', function() {
})
describe('constructor', function() {
it('should be ok to call without new', function() {
assert.ok(Wallet(seed) instanceof Wallet)
})
it('defaults to Bitcoin network', function() {
assert.equal(wallet.getMasterKey().network, networks.bitcoin)
})

Loading…
Cancel
Save