Skip to content

Commit 4d76989

Browse files
Export filterLogs function from eth/filters package for usage in nitro
1 parent f40a18e commit 4d76989

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

eth/filters/filter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
291291
if err != nil {
292292
return nil, err
293293
}
294-
logs := filterLogs(cached.logs, nil, nil, f.addresses, f.topics)
294+
logs := FilterLogs(cached.logs, nil, nil, f.addresses, f.topics)
295295
if len(logs) == 0 {
296296
return nil, nil
297297
}
@@ -313,8 +313,8 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
313313
return logs, nil
314314
}
315315

316-
// filterLogs creates a slice of logs matching the given criteria.
317-
func filterLogs(logs []*types.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*types.Log {
316+
// FilterLogs creates a slice of logs matching the given criteria.
317+
func FilterLogs(logs []*types.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*types.Log {
318318
var check = func(log *types.Log) bool {
319319
if fromBlock != nil && fromBlock.Int64() >= 0 && fromBlock.Uint64() > log.BlockNumber {
320320
return false

eth/filters/filter_system.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ func (es *EventSystem) handleLogs(filters filterIndex, ev []*types.Log) {
376376
return
377377
}
378378
for _, f := range filters[LogsSubscription] {
379-
matchedLogs := filterLogs(ev, f.logsCrit.FromBlock, f.logsCrit.ToBlock, f.logsCrit.Addresses, f.logsCrit.Topics)
379+
matchedLogs := FilterLogs(ev, f.logsCrit.FromBlock, f.logsCrit.ToBlock, f.logsCrit.Addresses, f.logsCrit.Topics)
380380
if len(matchedLogs) > 0 {
381381
f.logs <- matchedLogs
382382
}

0 commit comments

Comments
 (0)