From 5f64664676babae7065dc7560a5db780799c2c9e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 23 Jul 2023 12:12:01 -0400 Subject: [PATCH] fix: add synced listener on eth client to flag the synced status --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index 479eb02..6458a65 100644 --- a/src/index.ts +++ b/src/index.ts @@ -189,7 +189,12 @@ async function handleStatus(aq: ActiveQuery) { sendUpdate(); }; + const chainSyncedListener = () => { + sendUpdate(); + }; + client.on("update", chainProgressListener); + client.on("synced", chainSyncedListener); function sendUpdate() { aq.sendUpdate({ @@ -201,6 +206,7 @@ async function handleStatus(aq: ActiveQuery) { aq.setReceiveUpdate?.(() => { client.off("update", chainProgressListener); + client.off("synced", chainSyncedListener); aq.respond(); });