eth/filters: reuse handleLogs method for removed logs (#27438)

This commit is contained in:
Delweng 2023-06-08 17:40:22 +08:00 committed by GitHub
parent 5c51ef8527
commit 281e8cd5ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -444,15 +444,6 @@ func (es *EventSystem) handlePendingLogs(filters filterIndex, ev []*types.Log) {
} }
} }
func (es *EventSystem) handleRemovedLogs(filters filterIndex, ev core.RemovedLogsEvent) {
for _, f := range filters[LogsSubscription] {
matchedLogs := filterLogs(ev.Logs, f.logsCrit.FromBlock, f.logsCrit.ToBlock, f.logsCrit.Addresses, f.logsCrit.Topics)
if len(matchedLogs) > 0 {
f.logs <- matchedLogs
}
}
}
func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent) { func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent) {
for _, f := range filters[PendingTransactionsSubscription] { for _, f := range filters[PendingTransactionsSubscription] {
f.txs <- ev.Txs f.txs <- ev.Txs
@ -573,7 +564,7 @@ func (es *EventSystem) eventLoop() {
case ev := <-es.logsCh: case ev := <-es.logsCh:
es.handleLogs(index, ev) es.handleLogs(index, ev)
case ev := <-es.rmLogsCh: case ev := <-es.rmLogsCh:
es.handleRemovedLogs(index, ev) es.handleLogs(index, ev.Logs)
case ev := <-es.pendingLogsCh: case ev := <-es.pendingLogsCh:
es.handlePendingLogs(index, ev) es.handlePendingLogs(index, ev)
case ev := <-es.chainCh: case ev := <-es.chainCh: