From 189f9d0b17ca493ecc985a7896a0cc30dd157ca2 Mon Sep 17 00:00:00 2001 From: vickkkkkyy Date: Fri, 13 Mar 2026 20:26:20 +0800 Subject: [PATCH] eth/filters: check history pruning cutoff in GetFilterLogs (#33823) Return proper error for the log filters going beyond pruning point on a node with expired history. --- eth/filters/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/filters/api.go b/eth/filters/api.go index 2cb72dc114..e4ade96598 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -536,6 +536,9 @@ func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Lo if f.crit.ToBlock != nil { end = f.crit.ToBlock.Int64() } + if begin >= 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) { + return nil, &history.PrunedHistoryError{} + } // Construct the range filter filter = api.sys.NewRangeFilter(begin, end, f.crit.Addresses, f.crit.Topics, api.rangeLimit) }