Skip to content

Commit 80a5a9d

Browse files
committed
Use latest available block when fetching blocks in evmrpc
1 parent 57aa7ff commit 80a5a9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

evmrpc/filter.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ func (f *LogFetcher) fetchBlocksByCrit(ctx context.Context, crit filters.FilterC
405405
if begin > end {
406406
return nil, 0, false, fmt.Errorf("fromBlock %d is after toBlock %d", begin, end)
407407
}
408+
// Ensure we don't request blocks beyond the current blockchain height
409+
if end > latest {
410+
end = latest
411+
}
408412
res := make(chan *coretypes.ResultBlock, end-begin+1)
409413
defer close(res)
410414
runner := NewParallelRunner(MaxNumOfWorkers, int(end-begin+1))

0 commit comments

Comments
 (0)