Skip to content

Commit

Permalink
Merge pull request ethereum#151 from OffchainLabs/add-finalize-to-get…
Browse files Browse the repository at this point in the history
…hclient

Add "finalize" option to `gethclient`
  • Loading branch information
PlasmaPower authored Aug 23, 2022
2 parents 8e60813 + fe08019 commit 85fc1b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ func toBlockNumArg(number *big.Int) string {
if number.Cmp(pending) == 0 {
return "pending"
}
finalized := big.NewInt(int64(rpc.FinalizedBlockNumber))
if number.Cmp(finalized) == 0 {
return "finalized"
}
return hexutil.EncodeBig(number)
}

Expand Down
4 changes: 4 additions & 0 deletions ethclient/gethclient/gethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func toBlockNumArg(number *big.Int) string {
if number.Cmp(pending) == 0 {
return "pending"
}
finalized := big.NewInt(int64(rpc.FinalizedBlockNumber))
if number.Cmp(finalized) == 0 {
return "finalized"
}
return hexutil.EncodeBig(number)
}

Expand Down

0 comments on commit 85fc1b3

Please sign in to comment.