From aca5bfbe605bac1bcdfa8d4c74379a869694c061 Mon Sep 17 00:00:00 2001 From: "Alisher A. Khassanov" Date: Thu, 21 Mar 2024 12:24:19 +0500 Subject: [PATCH] Mark pending events as processed in all branches --- blockchain/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockchain/client.go b/blockchain/client.go index 5a6c7ba..052a606 100644 --- a/blockchain/client.go +++ b/blockchain/client.go @@ -138,6 +138,8 @@ func (c *Client) RegisterEventsListener(begin types.BlockNumber, callback Events cancelled := false go func() { + defer pendingEvents.Do(callback) + <-subscriptionStarted if begin >= types.BlockNumber(subscriptionStartBlock) { @@ -197,8 +199,6 @@ func (c *Client) RegisterEventsListener(begin types.BlockNumber, callback Events } } } - - pendingEvents.Do(callback) }() once := sync.Once{}