mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +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) {
|
func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {
|
||||||
arg := map[string]interface{}{
|
arg := map[string]interface{}{}
|
||||||
"address": q.Addresses,
|
if q.Addresses != nil {
|
||||||
"topics": q.Topics,
|
arg["address"] = q.Addresses
|
||||||
|
}
|
||||||
|
if q.Topics != nil {
|
||||||
|
arg["topics"] = q.Topics
|
||||||
}
|
}
|
||||||
if q.FromBlock == nil {
|
if q.FromBlock == nil {
|
||||||
arg["fromBlock"] = "0x0"
|
arg["fromBlock"] = "0x0"
|
||||||
|
|
|
||||||
|
|
@ -29,21 +29,6 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
"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) {
|
func TestToFilterArg(t *testing.T) {
|
||||||
blockHashErr := errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
blockHashErr := errors.New("cannot specify both BlockHash and FromBlock/ToBlock")
|
||||||
addresses := []common.Address{
|
addresses := []common.Address{
|
||||||
|
|
@ -59,6 +44,18 @@ func TestToFilterArg(t *testing.T) {
|
||||||
output interface{}
|
output interface{}
|
||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
"without addresses",
|
||||||
|
ethereum.FilterQuery{
|
||||||
|
FromBlock: big.NewInt(1),
|
||||||
|
ToBlock: big.NewInt(2),
|
||||||
|
},
|
||||||
|
map[string]interface{}{
|
||||||
|
"fromBlock": "0x1",
|
||||||
|
"toBlock": "0x2",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"without BlockHash",
|
"without BlockHash",
|
||||||
ethereum.FilterQuery{
|
ethereum.FilterQuery{
|
||||||
Loading…
Reference in a new issue