mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
parent
217b069ec0
commit
060a0e4810
2 changed files with 18 additions and 18 deletions
|
|
@ -493,9 +493,12 @@ func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuer
|
|||
}
|
||||
|
||||
func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {
|
||||
arg := map[string]interface{}{
|
||||
"address": q.Addresses,
|
||||
"topics": q.Topics,
|
||||
arg := map[string]interface{}{}
|
||||
if q.Addresses != nil {
|
||||
arg["address"] = q.Addresses
|
||||
}
|
||||
if q.Topics != nil {
|
||||
arg["topics"] = q.Topics
|
||||
}
|
||||
if q.FromBlock == nil {
|
||||
arg["fromBlock"] = "0x0"
|
||||
|
|
|
|||
|
|
@ -29,21 +29,6 @@ import (
|
|||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
||||
)
|
||||
|
||||
// Verify that Client implements the ethereum interfaces.
|
||||
var (
|
||||
_ = ethereum.ChainReader(&Client{})
|
||||
_ = ethereum.TransactionReader(&Client{})
|
||||
_ = ethereum.ChainStateReader(&Client{})
|
||||
_ = ethereum.ChainSyncReader(&Client{})
|
||||
_ = ethereum.ContractCaller(&Client{})
|
||||
_ = ethereum.GasEstimator(&Client{})
|
||||
_ = ethereum.GasPricer(&Client{})
|
||||
_ = ethereum.LogFilterer(&Client{})
|
||||
_ = ethereum.PendingStateReader(&Client{})
|
||||
// _ = ethereum.PendingStateEventer(&Client{})
|
||||
_ = ethereum.PendingContractCaller(&Client{})
|
||||
)
|
||||
|
||||
func TestToFilterArg(t *testing.T) {
|
||||
blockHashErr := errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
||||
addresses := []common.Address{
|
||||
|
|
@ -59,6 +44,18 @@ func TestToFilterArg(t *testing.T) {
|
|||
output interface{}
|
||||
err error
|
||||
}{
|
||||
{
|
||||
"without addresses",
|
||||
ethereum.FilterQuery{
|
||||
FromBlock: big.NewInt(1),
|
||||
ToBlock: big.NewInt(2),
|
||||
},
|
||||
map[string]interface{}{
|
||||
"fromBlock": "0x1",
|
||||
"toBlock": "0x2",
|
||||
},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"without BlockHash",
|
||||
ethereum.FilterQuery{
|
||||
Loading…
Reference in a new issue