eth/filters: fix pruned history error for genesis block (#31941)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Docker Image (push) Waiting to run

Fixes an issue where querying logs for block ranges starting from 0 would fail with an irrelevant
error on a pruned node. Now the correct "history is pruned" error will be returned.
This commit is contained in:
Lunor 2025-06-03 22:13:35 +07:00 committed by GitHub
parent ef464179a1
commit 778430a689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -359,7 +359,7 @@ func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*type
if begin > 0 && end > 0 && begin > end {
return nil, errInvalidBlockRange
}
if begin > 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) {
if begin >= 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) {
return nil, &history.PrunedHistoryError{}
}
// Construct the range filter