From e0d3a3de8f687b560a18a5a52425547de0bed79e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 16 Sep 2023 17:59:44 -0400 Subject: [PATCH] fix: creating chainProgressListener event handler wrong --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 798d202..c34d4a0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -253,10 +253,10 @@ async function handleStatus(aq: ActiveQuery) { let chainProgress = node.chain.getProgress(); let chainPeers = node.pool.peers.size(); - const chainProgressListener = node.chain.on("tip", () => { + const chainProgressListener = () => { chainProgress = node.chain.getProgress(); sendUpdate(); - }); + }; function peersListener() { chainPeers = node.pool.peers.size(); @@ -265,6 +265,7 @@ async function handleStatus(aq: ActiveQuery) { node.pool.on("peer", peersListener); node.pool.on("peer close", peersListener); + node.chain.on("tip", chainProgressListener); function sendUpdate() { aq.sendUpdate({