mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
execute different subscription in parallel way
This commit is contained in:
parent
0ec63272bf
commit
2005bf6b67
1 changed files with 14 additions and 10 deletions
|
|
@ -439,17 +439,21 @@ func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent)
|
|||
}
|
||||
|
||||
func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) {
|
||||
for _, f := range filters[BlocksSubscription] {
|
||||
f.headers <- ev.Header
|
||||
}
|
||||
|
||||
// Handle transaction receipts subscriptions when a new block is added
|
||||
for _, f := range filters[TransactionReceiptsSubscription] {
|
||||
matchedReceipts := filterReceipts(f.txHashes, ev)
|
||||
if len(matchedReceipts) > 0 {
|
||||
f.receipts <- matchedReceipts
|
||||
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)
|
||||
if len(matchedReceipts) > 0 {
|
||||
f.receipts <- matchedReceipts
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// eventLoop (un)installs filters and processes mux events.
|
||||
|
|
|
|||
Loading…
Reference in a new issue