From 77f14bc8462c5cc22aecd79a8e83da143d651a49 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 1 Oct 2014 12:41:51 -0300 Subject: [PATCH] ignore corrupted TX proposals when imported a backup --- js/models/TxProposals.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/models/TxProposals.js b/js/models/TxProposals.js index 80e3648c5..d800ddacf 100644 --- a/js/models/TxProposals.js +++ b/js/models/TxProposals.js @@ -10,6 +10,7 @@ var Script = bitcore.Script; var Key = bitcore.Key; var buffertools = bitcore.buffertools; var preconditions = require('preconditions').instance(); +var log = require('../log'); function TxProposals(opts) { opts = opts || {}; @@ -27,11 +28,16 @@ TxProposals.fromObj = function(o, forceOpts) { }); o.txps.forEach(function(o2) { - var t = TxProposal.fromObj(o2, forceOpts); - if (t.builder) { + try { + var t = TxProposal.fromObj(o2, forceOpts); + } catch (e) { + log.info('Ignoring corrupted TxProposal:', o2, e); + } + if (t && t.builder) { var id = t.getId(); ret.txps[id] = t; } + }); return ret; };