Skip to content

refactor: use the built-in max/min to simplify the code #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/request_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
14 changes: 0 additions & 14 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down