From 7ca0a23c66384315717f09248a68953cfc1496bf Mon Sep 17 00:00:00 2001 From: Enzo Cioppettini <48031343+ecioppettini@users.noreply.github.com> Date: Fri, 15 Dec 2023 20:47:10 -0300 Subject: [PATCH] cardano-presync: avoid error when there was no previous sync started (#271) * cardano-presync: avoid error when there was no previous sync started * fix if condition --- packages/engine/paima-runtime/src/runtime-loops.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/engine/paima-runtime/src/runtime-loops.ts b/packages/engine/paima-runtime/src/runtime-loops.ts index 39c297779..7de996a30 100644 --- a/packages/engine/paima-runtime/src/runtime-loops.ts +++ b/packages/engine/paima-runtime/src/runtime-loops.ts @@ -62,10 +62,14 @@ async function runPresync( startBlockHeight ); - if (!ENV.CARP_URL && presyncBlockHeight[Network.CARDANO]) { - throw new Error( - '[paima-runtime] Detected Cardano CDE sync in progress, but CARP_URL is not set.' - ); + if (!ENV.CARP_URL) { + if (presyncBlockHeight[Network.CARDANO] === -1) { + delete presyncBlockHeight[Network.CARDANO]; + } else { + throw new Error( + '[paima-runtime] Detected Cardano CDE sync in progress, but CARP_URL is not set.' + ); + } } if (run) {