add forceNetwork parameter and test it

This commit is contained in:
Manuel Araoz 2014-07-08 12:34:49 -03:00
commit 00cf32fc8d
3 changed files with 17 additions and 0 deletions

View file

@ -19,6 +19,7 @@ var AddressIndex = require('./AddressIndex');
var PublicKeyRing = require('./PublicKeyRing');
var TxProposals = require('./TxProposals');
var PrivateKey = require('./PrivateKey');
var copayConfig = require('../../../config');
function Wallet(opts) {
var self = this;
@ -33,6 +34,9 @@ function Wallet(opts) {
throw new Error('missing required option for Wallet: ' + k);
self[k] = opts[k];
});
if (copayConfig.forceNetwork && opts.networkName !== copayConfig.networkName)
throw new Error('Network forced to '+copayConfig.networkName+
' and tried to create a Wallet with network '+opts.networkName);
this.log('creating ' + opts.requiredCopayers + ' of ' + opts.totalCopayers + ' wallet');