ignore corrupted TX proposals when imported a backup
This commit is contained in:
parent
1c7c5b39ff
commit
77f14bc846
1 changed files with 8 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ var Script = bitcore.Script;
|
||||||
var Key = bitcore.Key;
|
var Key = bitcore.Key;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var preconditions = require('preconditions').instance();
|
var preconditions = require('preconditions').instance();
|
||||||
|
var log = require('../log');
|
||||||
|
|
||||||
function TxProposals(opts) {
|
function TxProposals(opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
@ -27,11 +28,16 @@ TxProposals.fromObj = function(o, forceOpts) {
|
||||||
});
|
});
|
||||||
|
|
||||||
o.txps.forEach(function(o2) {
|
o.txps.forEach(function(o2) {
|
||||||
var t = TxProposal.fromObj(o2, forceOpts);
|
try {
|
||||||
if (t.builder) {
|
var t = TxProposal.fromObj(o2, forceOpts);
|
||||||
|
} catch (e) {
|
||||||
|
log.info('Ignoring corrupted TxProposal:', o2, e);
|
||||||
|
}
|
||||||
|
if (t && t.builder) {
|
||||||
var id = t.getId();
|
var id = t.getId();
|
||||||
ret.txps[id] = t;
|
ret.txps[id] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue