execute different subscription in parallel way

This commit is contained in:
maskpp 2025-10-19 17:39:49 +08:00
parent 0ec63272bf
commit 2005bf6b67

View file

@ -439,10 +439,13 @@ func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent)
}
func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) {
go func() {
for _, f := range filters[BlocksSubscription] {
f.headers <- ev.Header
}
}()
go func() {
// Handle transaction receipts subscriptions when a new block is added
for _, f := range filters[TransactionReceiptsSubscription] {
matchedReceipts := filterReceipts(f.txHashes, ev)
@ -450,6 +453,7 @@ func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent)
f.receipts <- matchedReceipts
}
}
}()
}
// eventLoop (un)installs filters and processes mux events.