Skip to content

Commit

Permalink
cardano-presync: avoid error when there was no previous sync started (#…
Browse files Browse the repository at this point in the history
…271)

* cardano-presync: avoid error when there was no previous sync started

* fix if condition
  • Loading branch information
ecioppettini authored Dec 15, 2023
1 parent a578dca commit 7ca0a23
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/engine/paima-runtime/src/runtime-loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7ca0a23

Please sign in to comment.