ethclient: serialize negative block number as "pending" (#21177)

Fixes #21175

Co-authored-by: sammy007 <sammy007@users.noreply.github.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
This commit is contained in:
Sammy Libre
2020-07-21 13:51:15 +05:00
committed by GitHub
parent 4366c45e4e
commit 7163a6664e
4 changed files with 30 additions and 12 deletions

View File

@ -282,6 +282,10 @@ func toBlockNumArg(number *big.Int) string {
if number == nil {
return "latest"
}
pending := big.NewInt(-1)
if number.Cmp(pending) == 0 {
return "pending"
}
return hexutil.EncodeBig(number)
}