mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-25 19:12:24 +00:00
ethclient: add 'finalized' and 'safe' block number support (#25580)
This commit is contained in:
parent
44b36a0cdd
commit
8df8eb4e7a
2 changed files with 16 additions and 0 deletions
|
|
@ -570,6 +570,14 @@ func toBlockNumArg(number *big.Int) string {
|
||||||
if number.Cmp(pending) == 0 {
|
if number.Cmp(pending) == 0 {
|
||||||
return "pending"
|
return "pending"
|
||||||
}
|
}
|
||||||
|
finalized := big.NewInt(int64(rpc.FinalizedBlockNumber))
|
||||||
|
if number.Cmp(finalized) == 0 {
|
||||||
|
return "finalized"
|
||||||
|
}
|
||||||
|
safe := big.NewInt(int64(rpc.SafeBlockNumber))
|
||||||
|
if number.Cmp(safe) == 0 {
|
||||||
|
return "safe"
|
||||||
|
}
|
||||||
return hexutil.EncodeBig(number)
|
return hexutil.EncodeBig(number)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,14 @@ func toBlockNumArg(number *big.Int) string {
|
||||||
if number.Cmp(pending) == 0 {
|
if number.Cmp(pending) == 0 {
|
||||||
return "pending"
|
return "pending"
|
||||||
}
|
}
|
||||||
|
finalized := big.NewInt(int64(rpc.FinalizedBlockNumber))
|
||||||
|
if number.Cmp(finalized) == 0 {
|
||||||
|
return "finalized"
|
||||||
|
}
|
||||||
|
safe := big.NewInt(int64(rpc.SafeBlockNumber))
|
||||||
|
if number.Cmp(safe) == 0 {
|
||||||
|
return "safe"
|
||||||
|
}
|
||||||
return hexutil.EncodeBig(number)
|
return hexutil.EncodeBig(number)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue