mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
ethclient: default fromBlock/toBlock to 'latest' when nil
This commit is contained in:
parent
4414e2833f
commit
1f07b51e1d
2 changed files with 2 additions and 6 deletions
|
|
@ -496,12 +496,8 @@ func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {
|
|||
if q.FromBlock != nil || q.ToBlock != nil {
|
||||
return nil, errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
||||
}
|
||||
} else {
|
||||
if q.FromBlock == nil {
|
||||
arg["fromBlock"] = "0x0"
|
||||
} else {
|
||||
arg["fromBlock"] = toBlockNumArg(q.FromBlock)
|
||||
}
|
||||
arg["toBlock"] = toBlockNumArg(q.ToBlock)
|
||||
}
|
||||
return arg, nil
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ func TestToFilterArg(t *testing.T) {
|
|||
},
|
||||
map[string]interface{}{
|
||||
"address": addresses,
|
||||
"fromBlock": "0x0",
|
||||
"fromBlock": "latest",
|
||||
"toBlock": "latest",
|
||||
"topics": [][]common.Hash{},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue