From 3cd0671db0fe104061914d856e53878a43349362 Mon Sep 17 00:00:00 2001 From: lcmmhcc <37269413+lcmmhcc@users.noreply.github.com> Date: Fri, 29 Apr 2022 15:46:18 +0800 Subject: [PATCH] Merge PR: fix toBlock oversize error (#1959) Co-authored-by: KamiD <44460798+KamiD@users.noreply.github.com> --- app/rpc/namespaces/eth/filters/filters.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/rpc/namespaces/eth/filters/filters.go b/app/rpc/namespaces/eth/filters/filters.go index 174da20c4e..23e6658887 100644 --- a/app/rpc/namespaces/eth/filters/filters.go +++ b/app/rpc/namespaces/eth/filters/filters.go @@ -110,7 +110,9 @@ func (f *Filter) Logs(ctx context.Context) ([]*ethtypes.Log, error) { if f.criteria.ToBlock.Int64() == -1 { f.criteria.ToBlock = big.NewInt(head) } - + if f.criteria.ToBlock.Int64() > head { + f.criteria.ToBlock = big.NewInt(head) + } if f.criteria.FromBlock.Int64() <= tmtypes.GetStartBlockHeight() || f.criteria.ToBlock.Int64() <= tmtypes.GetStartBlockHeight() { return nil, fmt.Errorf("from and to block height must greater than %d", tmtypes.GetStartBlockHeight())