From 4f12b60899454e4c376a630e7c231074d269785c Mon Sep 17 00:00:00 2001 From: maskpp Date: Sun, 19 Oct 2025 21:06:19 +0800 Subject: [PATCH] fix bug --- eth/filters/filter_system.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go index 05476dd050..3ce98897c4 100644 --- a/eth/filters/filter_system.go +++ b/eth/filters/filter_system.go @@ -37,6 +37,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" + "golang.org/x/sync/errgroup" ) // Config represents the configuration of the filter system. @@ -439,13 +440,15 @@ func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent) } func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) { - go func() { + var eg errgroup.Group + eg.Go(func() error { for _, f := range filters[BlocksSubscription] { f.headers <- ev.Header } - }() + return nil + }) - go func() { + eg.Go(func() error { // Handle transaction receipts subscriptions when a new block is added for _, f := range filters[TransactionReceiptsSubscription] { matchedReceipts := filterReceipts(f.txHashes, ev) @@ -453,7 +456,9 @@ func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) f.receipts <- matchedReceipts } } - }() + return nil + }) + _ = eg.Wait() } // eventLoop (un)installs filters and processes mux events.