fix: add synced listener on eth client to flag the synced status

This commit is contained in:
Derrick Hammer 2023-07-23 12:12:01 -04:00
parent bb0d3f1bb2
commit 5f64664676
1 changed files with 6 additions and 0 deletions

View File

@ -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();
});