graphql: logs return error if from block > to (#28412)

As per discussion in ethereum/execution-apis#475

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
Delweng 2023-10-25 21:20:23 +08:00 committed by GitHub
parent 96b75033c0
commit f7b62e5506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1417,6 +1417,9 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria
if args.Filter.ToBlock != nil { if args.Filter.ToBlock != nil {
end = int64(*args.Filter.ToBlock) end = int64(*args.Filter.ToBlock)
} }
if begin > 0 && end > 0 && begin > end {
return nil, errInvalidBlockRange
}
var addresses []common.Address var addresses []common.Address
if args.Filter.Addresses != nil { if args.Filter.Addresses != nil {
addresses = *args.Filter.Addresses addresses = *args.Filter.Addresses