check for network on fromJSON.

This commit is contained in:
Christopher Jeffrey 2015-12-09 16:32:01 -08:00
parent 57491aaadc
commit ef1244442f
2 changed files with 4 additions and 2 deletions

View File

@ -528,7 +528,8 @@ Chain.prototype.toJSON = function toJSON() {
Chain.prototype.fromJSON = function fromJSON(json) {
assert.equal(json.v, 1);
assert.equal(json.type, 'chain');
assert.equal(json.network, network.type);
if (json.network)
assert.equal(json.network, network.type);
this.index.hashes = json.hashes.slice();
this.index.ts = json.ts.slice();
this.index.heights = json.heights.slice();

View File

@ -434,7 +434,8 @@ Wallet.prototype.toJSON = function toJSON() {
Wallet.fromJSON = function fromJSON(json) {
assert.equal(json.v, 1);
assert.equal(json.type, 'wallet');
assert.equal(json.network, network.type);
if (json.network)
assert.equal(json.network, network.type);
var priv;
var pub;