From fa8ec9f7683d74b6035837a3a2e242d0bd9e7df9 Mon Sep 17 00:00:00 2001 From: barrystyle Date: Sun, 11 Aug 2019 16:58:34 +0000 Subject: [PATCH] Display exception in tx loop (was 'Cannot read property length of undefined') --- lib/database.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/database.js b/lib/database.js index 619f3a15e..3f88eb941 100644 --- a/lib/database.js +++ b/lib/database.js @@ -639,6 +639,7 @@ module.exports = { if (blockhash) { lib.get_block(blockhash, function(block) { if (block) { + try { lib.syncLoop(block.tx.length, function (subloop) { var i = subloop.iteration(); Tx.findOne({txid: block.tx[i]}, function(err, tx) { @@ -664,6 +665,9 @@ module.exports = { block = null; loop.next(); }); + } catch (e) { + console.log('hit an exception: %s', e); + } } else { console.log('block not found: %s', blockhash); loop.next();