From ed51166a057618ea70d7219f3634c59d30ec4df0 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 24 Oct 2023 22:10:13 +0800 Subject: [PATCH] eth/filters: check in rpc level Signed-off-by: jsvisa --- eth/filters/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/filters/api.go b/eth/filters/api.go index 3047d226462e..a7d9a08252ab 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -348,6 +348,9 @@ func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*type if crit.ToBlock != nil { end = crit.ToBlock.Int64() } + if begin > 0 && end > 0 && begin > end { + return nil, errInvalidBlockRange + } // Construct the range filter filter = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics) }