allow Wallet to work with testnet
This commit is contained in:
parent
102e2b3d48
commit
49c2fc06b5
1 changed files with 5 additions and 5 deletions
|
@ -13,8 +13,8 @@ var HDWallet = require('./hdwallet.js')
|
||||||
var SecureRandom = require('./jsbn/rng');
|
var SecureRandom = require('./jsbn/rng');
|
||||||
var rng = new SecureRandom();
|
var rng = new SecureRandom();
|
||||||
|
|
||||||
var Wallet = function (seed) {
|
var Wallet = function (seed, network) {
|
||||||
if (!(this instanceof Wallet)) { return new Wallet(seed); }
|
if (!(this instanceof Wallet)) { return new Wallet(seed, network); }
|
||||||
|
|
||||||
// Stored in a closure to make accidental serialization less likely
|
// Stored in a closure to make accidental serialization less likely
|
||||||
var keys = [];
|
var keys = [];
|
||||||
|
@ -28,16 +28,16 @@ var Wallet = function (seed) {
|
||||||
this.outputs = {};
|
this.outputs = {};
|
||||||
|
|
||||||
// Make a new master key
|
// Make a new master key
|
||||||
this.newMasterKey = function(seed) {
|
this.newMasterKey = function(seed, network) {
|
||||||
if (!seed) {
|
if (!seed) {
|
||||||
var seedBytes = new Array(32);
|
var seedBytes = new Array(32);
|
||||||
rng.nextBytes(seedBytes);
|
rng.nextBytes(seedBytes);
|
||||||
seed = conv.bytesToString(seedBytes)
|
seed = conv.bytesToString(seedBytes)
|
||||||
}
|
}
|
||||||
masterkey = new HDWallet(seed);
|
masterkey = new HDWallet(seed, network);
|
||||||
keys = []
|
keys = []
|
||||||
}
|
}
|
||||||
this.newMasterKey(seed)
|
this.newMasterKey(seed, network)
|
||||||
|
|
||||||
// Add a new address
|
// Add a new address
|
||||||
this.generateAddress = function() {
|
this.generateAddress = function() {
|
||||||
|
|
Loading…
Reference in a new issue