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 {
|
if q.FromBlock != nil || q.ToBlock != nil {
|
||||||
return nil, errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
return nil, errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if q.FromBlock == nil {
|
|
||||||
arg["fromBlock"] = "0x0"
|
|
||||||
} else {
|
} else {
|
||||||
arg["fromBlock"] = toBlockNumArg(q.FromBlock)
|
arg["fromBlock"] = toBlockNumArg(q.FromBlock)
|
||||||
}
|
|
||||||
arg["toBlock"] = toBlockNumArg(q.ToBlock)
|
arg["toBlock"] = toBlockNumArg(q.ToBlock)
|
||||||
}
|
}
|
||||||
return arg, nil
|
return arg, nil
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func TestToFilterArg(t *testing.T) {
|
||||||
},
|
},
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"address": addresses,
|
"address": addresses,
|
||||||
"fromBlock": "0x0",
|
"fromBlock": "latest",
|
||||||
"toBlock": "latest",
|
"toBlock": "latest",
|
||||||
"topics": [][]common.Hash{},
|
"topics": [][]common.Hash{},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue