Skip to content
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

rpc: change BlockNumber constant values to match ethclient #27219

Merged
merged 8 commits into from
May 23, 2023
11 changes: 4 additions & 7 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,19 +582,16 @@ func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) er
}

func toBlockNumArg(number *big.Int) string {
if number == nil {
if number == nil || number.Cmp(big.NewInt(int64(rpc.LatestBlockNumber))) == 0 {
return "latest"
}
pending := big.NewInt(-1)
if number.Cmp(pending) == 0 {
if number.Cmp(big.NewInt(int64(rpc.PendingBlockNumber))) == 0 {
return "pending"
}
finalized := big.NewInt(int64(rpc.FinalizedBlockNumber))
if number.Cmp(finalized) == 0 {
if number.Cmp(big.NewInt(int64(rpc.FinalizedBlockNumber))) == 0 {
return "finalized"
}
safe := big.NewInt(int64(rpc.SafeBlockNumber))
if number.Cmp(safe) == 0 {
if number.Cmp(big.NewInt(int64(rpc.SafeBlockNumber))) == 0 {
return "safe"
}
return hexutil.EncodeBig(number)
Expand Down