Skip to content

Commit

Permalink
fix to do not override logs at filter (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Oct 22, 2024
1 parent 1839cea commit 53fa495
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jsonrpc/namespaces/eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,18 @@ func (api *FilterAPI) subscribeEvents() {
api.filtersMut.Lock()
for _, f := range api.filters {
if f.ty == ethfilters.LogsSubscription {
logs = filterLogs(logs, f.crit.FromBlock, f.crit.ToBlock, f.crit.Addresses, f.crit.Topics)
logs := filterLogs(logs, f.crit.FromBlock, f.crit.ToBlock, f.crit.Addresses, f.crit.Topics)
if len(logs) > 0 {
f.logs = append(f.logs, logs...)
}
}
}
for _, s := range api.subscriptions {
if s.ty == ethfilters.LogsSubscription {
s.logsChan <- logs
logs := filterLogs(logs, s.crit.FromBlock, s.crit.ToBlock, s.crit.Addresses, s.crit.Topics)
if len(logs) > 0 {
s.logsChan <- logs
}
}
}
api.filtersMut.Unlock()
Expand Down

0 comments on commit 53fa495

Please sign in to comment.