From db259d1ec8acf64c0bfb74c0989b6e0d52dfc8fc Mon Sep 17 00:00:00 2001 From: evenevent Date: Thu, 27 Mar 2025 17:45:11 +0800 Subject: [PATCH] refactor: use the built-in max/min to simplify the code Signed-off-by: evenevent --- server/request_processor.go | 2 +- server/util.go | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/server/request_processor.go b/server/request_processor.go index 07946dd..9002ade 100644 --- a/server/request_processor.go +++ b/server/request_processor.go @@ -482,7 +482,7 @@ func (r *RpcRequest) GetAddressNonceRange(address string) (minNonce, maxNonce ui // Get maximum nonce by looking at redis, which has current pending transactions _redisMaxNonce, _, _ := RState.GetSenderMaxNonce(r.txFrom) - maxNonce = Max(minNonce, _redisMaxNonce) + maxNonce = max(minNonce, _redisMaxNonce) return minNonce, maxNonce, nil } diff --git a/server/util.go b/server/util.go index efec26c..6edd52e 100644 --- a/server/util.go +++ b/server/util.go @@ -17,20 +17,6 @@ import ( "github.com/pkg/errors" ) -func Min(a uint64, b uint64) uint64 { - if a < b { - return a - } - return b -} - -func Max(a uint64, b uint64) uint64 { - if a > b { - return a - } - return b -} - func GetTx(rawTxHex string) (*ethtypes.Transaction, error) { if len(rawTxHex) < 2 { return nil, errors.New("invalid raw transaction")