diff --git a/eth/filters/api.go b/eth/filters/api.go index 54e6e16604..882b43511a 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -400,6 +400,15 @@ func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Lo var filter *Filter if f.crit.BlockHash != nil { + // ensure the filter criteria does not specify block hash below the + // history prune point + header, err := api.sys.backend.HeaderByHash(ctx, *f.crit.BlockHash) + if err != nil { + return nil, err + } + if header.Number.Uint64() < api.events.backend.HistoryCutoff() { + return nil, &prunedHistoryError{} + } // Block filter requested, construct a single-shot filter filter = api.sys.NewBlockFilter(*f.crit.BlockHash, f.crit.Addresses, f.crit.Topics) } else {