From ccb90c53a468d140b5233b5fb450e30724772744 Mon Sep 17 00:00:00 2001 From: Alessandro Rezzi Date: Thu, 10 Oct 2024 13:09:58 +0200 Subject: [PATCH] Catch cursor.continue() errors (#422) --- scripts/database.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/database.js b/scripts/database.js index 1e6fa95b2..0af8d7a0f 100644 --- a/scripts/database.js +++ b/scripts/database.js @@ -338,7 +338,11 @@ export class Database { // Append the TXID from the Index key cursor.value.txid = cursor.key; txs.push(cursor.value); - await cursor.continue(); + try { + await cursor.continue(); + } catch { + break; + } } // Now convert the raw TX components to Transaction Classes @@ -456,7 +460,11 @@ export class Database { if (cursor.value.blockHeight === -1) { await cursor.delete(); } - cursor = await cursor.continue(); + try { + cursor = await cursor.continue(); + } catch { + break; + } } })(); }