commit
43806a5825
6 changed files with 38 additions and 7 deletions
|
|
@ -11,6 +11,12 @@ angular.module('copayApp.controllers').controller('SettingsController',
|
|||
$scope.networkHost = config.network.host;
|
||||
$scope.networkPort = config.network.port;
|
||||
|
||||
|
||||
|
||||
$scope.$watch('networkName', function(net) {
|
||||
$scope.insightHost = net === 'testnet' ? 'test.insight.is' : 'live.insight.is';
|
||||
});
|
||||
|
||||
$scope.save = function() {
|
||||
var network = config.network;
|
||||
network.key = $scope.networkKey;
|
||||
|
|
|
|||
|
|
@ -175,6 +175,11 @@ Wallet.prototype._handleDisconnect = function(peerID) {
|
|||
this.emit('disconnect', peerID);
|
||||
};
|
||||
|
||||
|
||||
Wallet.prototype.getNetworkName = function() {
|
||||
return this.publicKeyRing.network.name;
|
||||
};
|
||||
|
||||
Wallet.prototype._optsToObj = function() {
|
||||
var obj = {
|
||||
id: this.id,
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ function WalletFactory(config, version) {
|
|||
this.network = new Network(config.network);
|
||||
this.blockchain = new Blockchain(config.blockchain);
|
||||
|
||||
this.networkName = config.networkName;
|
||||
this.verbose = config.verbose;
|
||||
this.networkName = config.networkName;
|
||||
this.verbose = config.verbose;
|
||||
this.walletDefaults = config.wallet;
|
||||
this.version = version;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
WalletFactory.prototype.log = function(){
|
||||
|
|
@ -139,6 +139,20 @@ WalletFactory.prototype._checkVersion = function(inVersion) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
WalletFactory.prototype._checkNetwork = function(inNetworkName) {
|
||||
if( this.networkName !== inNetworkName ) {
|
||||
throw new Error('This Wallet is configured for '
|
||||
+ inNetworkName
|
||||
+ ' while currently Copay is configured for: '
|
||||
+ this.networkName
|
||||
+ '. Check your settings.'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
WalletFactory.prototype.open = function(walletId, opts) {
|
||||
opts = opts || {};
|
||||
opts.id = walletId;
|
||||
|
|
@ -148,6 +162,7 @@ WalletFactory.prototype.open = function(walletId, opts) {
|
|||
var w = this.read(walletId);
|
||||
if (w) {
|
||||
this._checkVersion(w.version);
|
||||
this._checkNetwork(w.getNetworkName());
|
||||
w.store();
|
||||
}
|
||||
return w;
|
||||
|
|
@ -172,8 +187,7 @@ WalletFactory.prototype.decodeSecret = function(secret) {
|
|||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, cb) {
|
||||
var self = this;
|
||||
|
|
|
|||
|
|
@ -379,6 +379,8 @@ Network.prototype._sendToOne = function(copayerId, payload, sig, cb) {
|
|||
};
|
||||
|
||||
Network.prototype.send = function(copayerIds, payload, cb) {
|
||||
if (!payload || !this.netKey) return cb();
|
||||
|
||||
var self=this;
|
||||
if (!copayerIds) {
|
||||
copayerIds = this.connectedCopayers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue