fix: creating chainProgressListener event handler wrong

This commit is contained in:
Derrick Hammer 2023-09-16 17:59:44 -04:00
parent 1d0445c63b
commit e0d3a3de8f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 2 deletions

View File

@ -253,10 +253,10 @@ async function handleStatus(aq: ActiveQuery) {
let chainProgress = node.chain.getProgress(); let chainProgress = node.chain.getProgress();
let chainPeers = node.pool.peers.size(); let chainPeers = node.pool.peers.size();
const chainProgressListener = node.chain.on("tip", () => { const chainProgressListener = () => {
chainProgress = node.chain.getProgress(); chainProgress = node.chain.getProgress();
sendUpdate(); sendUpdate();
}); };
function peersListener() { function peersListener() {
chainPeers = node.pool.peers.size(); chainPeers = node.pool.peers.size();
@ -265,6 +265,7 @@ async function handleStatus(aq: ActiveQuery) {
node.pool.on("peer", peersListener); node.pool.on("peer", peersListener);
node.pool.on("peer close", peersListener); node.pool.on("peer close", peersListener);
node.chain.on("tip", chainProgressListener);
function sendUpdate() { function sendUpdate() {
aq.sendUpdate({ aq.sendUpdate({