Skip to content

Commit 4f567f0

Browse files
authored
Merge pull request #2190 from MartinOndejka/fix-fetch-constants
Run fetchGenesisConstants even if fetchLastBlock fails
2 parents 026e20e + 7b1c06f commit 4f567f0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/lib/mina/v1/fetch.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,18 @@ async function fetchMissingData(graphqlEndpoint: string, archiveEndpoint?: strin
371371
if (network !== undefined) {
372372
promises.push(
373373
(async () => {
374-
try {
375-
await fetchLastBlock(graphqlEndpoint);
376-
await fetchGenesisConstants(graphqlEndpoint);
374+
const [lastBlockOk, constantsOk] = await Promise.all([
375+
fetchLastBlock(graphqlEndpoint)
376+
.then(() => true)
377+
.catch(() => false),
378+
fetchGenesisConstants(graphqlEndpoint)
379+
.then(() => true)
380+
.catch(() => false),
381+
]);
382+
383+
if (lastBlockOk && constantsOk) {
377384
delete networksToFetch[network[0]];
378-
} catch {}
385+
}
379386
})()
380387
);
381388
}

0 commit comments

Comments
 (0)