Browse Source

fix network in wallet secret

activeAddress
Ivan Socolsky 10 years ago
parent
commit
384a1daeb6
  1. 4
      lib/clientlib.js

4
lib/clientlib.js

@ -87,6 +87,8 @@ ClientLib.prototype._loadAndCheck = function() {
ClientLib.prototype.createWallet = function(walletName, copayerName, m, n, network, cb) { ClientLib.prototype.createWallet = function(walletName, copayerName, m, n, network, cb) {
var self = this; var self = this;
network = network || 'livenet'; network = network || 'livenet';
if (!_.contains(['testnet', 'livenet'], network))
return cb('Invalid network');
var data = this._load(); var data = this._load();
if (data) return cb('File ' + this.filename + ' already contains a wallet'); if (data) return cb('File ' + this.filename + ' already contains a wallet');
@ -122,7 +124,7 @@ ClientLib.prototype.createWallet = function(walletName, copayerName, m, n, netwo
} }
var walletId = body.walletId; var walletId = body.walletId;
var secret = walletId + ':' + privKey.toString() + ':' + (network ? 'T' : 'L'); var secret = walletId + ':' + privKey.toString() + ':' + (network == 'testnet' ? 'T' : 'L');
data.secret = secret; data.secret = secret;
self._save(data); self._save(data);

Loading…
Cancel
Save