From ef1244442f0f6734e3f11ff4dbb1182b47cc5b60 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 9 Dec 2015 16:32:01 -0800 Subject: [PATCH] check for network on fromJSON. --- lib/bcoin/chain.js | 3 ++- lib/bcoin/wallet.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index c0937331..308f6925 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -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(); diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 4b21ba97..dc4864aa 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -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;