mirror of https://github.com/BTCPrivate/copay.git
fix networkname on partial import
This commit is contained in:
parent
7f0e9cd03d
commit
b70857f9e1
|
@ -533,13 +533,14 @@ Wallet.prototype.toObj = function() {
|
||||||
// fromObj => from a trusted source
|
// fromObj => from a trusted source
|
||||||
Wallet.fromObj = function(o, storage, network, blockchain) {
|
Wallet.fromObj = function(o, storage, network, blockchain) {
|
||||||
var opts = JSON.parse(JSON.stringify(o.opts));
|
var opts = JSON.parse(JSON.stringify(o.opts));
|
||||||
|
|
||||||
opts.addressBook = o.addressBook;
|
opts.addressBook = o.addressBook;
|
||||||
|
|
||||||
if (o.privateKey)
|
if (o.privateKey)
|
||||||
opts.privateKey = PrivateKey.fromObj(o.privateKey);
|
opts.privateKey = PrivateKey.fromObj(o.privateKey);
|
||||||
else
|
else
|
||||||
opts.privateKey = new PrivateKey({
|
opts.privateKey = new PrivateKey({
|
||||||
networkName: this.networkName
|
networkName: opts.networkName
|
||||||
});
|
});
|
||||||
|
|
||||||
if (o.publicKeyRing)
|
if (o.publicKeyRing)
|
||||||
|
|
|
@ -55,11 +55,14 @@ WalletFactory.prototype.fromObj = function(obj, skipFields) {
|
||||||
// not stored options
|
// not stored options
|
||||||
obj.opts.reconnectDelay = this.walletDefaults.reconnectDelay;
|
obj.opts.reconnectDelay = this.walletDefaults.reconnectDelay;
|
||||||
|
|
||||||
|
// this is only used if private key or public key ring is skipped
|
||||||
|
obj.opts.networkName = this.networkName;
|
||||||
|
|
||||||
skipFields = skipFields || [];
|
skipFields = skipFields || [];
|
||||||
skipFields.forEach(function(k){
|
skipFields.forEach(function(k){
|
||||||
if (obj[k])
|
if (obj[k]) {
|
||||||
delete obj[k];
|
delete obj[k];
|
||||||
else
|
} else
|
||||||
throw new Error('unknown field:' + k);
|
throw new Error('unknown field:' + k);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue