mobile, ethclient, core/types: enable filtering on pending/latest logs

avoid converting big.Int to int64() (to avoid loss of information),
instead convert const values to big.Int
This commit is contained in:
Yossi Rizgan 2017-11-19 14:22:56 +02:00
parent 47ff71bb9b
commit d1f71696d1

View file

@ -257,12 +257,11 @@ func toBlockNumArg(number *big.Int) string {
if number == nil {
return "latest"
}
switch number.Int64() {
case rpc.PendingBlockNumber.Int64():
if number.Cmp(big.NewInt(rpc.PendingBlockNumber.Int64())) == 0 {
return "pending"
case rpc.LatestBlockNumber.Int64():
} else if number.Cmp(big.NewInt(rpc.LatestBlockNumber.Int64())) == 0 {
return "latest"
case rpc.EarliestBlockNumber.Int64():
} else if number.Cmp(big.NewInt(rpc.EarliestBlockNumber.Int64())) == 0 {
return "earliest"
}
return hexutil.EncodeBig(number)