mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
fix bug
This commit is contained in:
parent
2005bf6b67
commit
4f12b60899
1 changed files with 9 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config represents the configuration of the filter system.
|
// 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) {
|
func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) {
|
||||||
go func() {
|
var eg errgroup.Group
|
||||||
|
eg.Go(func() error {
|
||||||
for _, f := range filters[BlocksSubscription] {
|
for _, f := range filters[BlocksSubscription] {
|
||||||
f.headers <- ev.Header
|
f.headers <- ev.Header
|
||||||
}
|
}
|
||||||
}()
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
go func() {
|
eg.Go(func() error {
|
||||||
// Handle transaction receipts subscriptions when a new block is added
|
// Handle transaction receipts subscriptions when a new block is added
|
||||||
for _, f := range filters[TransactionReceiptsSubscription] {
|
for _, f := range filters[TransactionReceiptsSubscription] {
|
||||||
matchedReceipts := filterReceipts(f.txHashes, ev)
|
matchedReceipts := filterReceipts(f.txHashes, ev)
|
||||||
|
|
@ -453,7 +456,9 @@ func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent)
|
||||||
f.receipts <- matchedReceipts
|
f.receipts <- matchedReceipts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
return nil
|
||||||
|
})
|
||||||
|
_ = eg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// eventLoop (un)installs filters and processes mux events.
|
// eventLoop (un)installs filters and processes mux events.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue