cgh: use geth for maxInt

This commit is contained in:
marcello33 2024-11-13 15:01:55 +01:00
parent 32138d70ad
commit 0634d11d86
No known key found for this signature in database
GPG key ID: 06128777E3C36B16

View file

@ -5,6 +5,7 @@ import (
"errors"
"strconv"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
@ -118,7 +119,7 @@ func getRpcBlockNumberFromString(blockNumber string) (rpc.BlockNumber, error) {
if err != nil {
return rpc.BlockNumber(0), errors.New("invalid block number")
}
if blckNum > uint64(^uint32(0)) {
if blckNum > math.MaxInt64 {
return rpc.BlockNumber(0), errors.New("block number out of range")
}
return rpc.BlockNumber(blckNum), nil