aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 23:36:01 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 23:36:01 +0800
commit43d521e90e9516429dd0499ff88bf3f37ec78c48 (patch)
tree42e912588cd5a5effdf319a30a641600caf93186 /rpc
parent0ac346f7078dba597d60f991c32ddbfd7be167ba (diff)
downloaddexon-43d521e90e9516429dd0499ff88bf3f37ec78c48.tar.gz
dexon-43d521e90e9516429dd0499ff88bf3f37ec78c48.tar.zst
dexon-43d521e90e9516429dd0499ff88bf3f37ec78c48.zip
Decouple core from rpc
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go37
1 files changed, 2 insertions, 35 deletions
diff --git a/rpc/api.go b/rpc/api.go
index f755f07bd..8803c28dd 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -6,7 +6,6 @@ import (
"sync"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -277,8 +276,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- opts := toFilterOptions(args)
- id := api.xeth().RegisterFilter(opts)
+ id := api.xeth().RegisterFilter(args.Earliest, args.Latest, args.Skip, args.Max, args.Address, args.Topics)
*reply = common.ToHex(big.NewInt(int64(id)).Bytes())
case "eth_newBlockFilter":
args := new(FilterStringArgs)
@@ -310,8 +308,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- opts := toFilterOptions(args)
- *reply = NewLogsRes(api.xeth().AllLogs(opts))
+ *reply = NewLogsRes(api.xeth().AllLogs(args.Earliest, args.Latest, args.Skip, args.Max, args.Address, args.Topics))
case "eth_getWork":
api.xeth().SetMining(true)
*reply = api.xeth().RemoteMining().GetWork()
@@ -456,33 +453,3 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
rpclogger.DebugDetailf("Reply: %T %s", reply, reply)
return nil
}
-
-func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions {
- var opts core.FilterOptions
-
- opts.Address = cAddress(options.Address)
- opts.Topics = cTopics(options.Topics)
-
- opts.Earliest = options.Earliest
- opts.Latest = options.Latest
-
- return &opts
-}
-
-func cAddress(a []string) []common.Address {
- bslice := make([]common.Address, len(a))
- for i, addr := range a {
- bslice[i] = common.HexToAddress(addr)
- }
- return bslice
-}
-
-func cTopics(t [][]string) [][]common.Hash {
- topics := make([][]common.Hash, len(t))
- for i, iv := range t {
- for j, jv := range iv {
- topics[i][j] = common.HexToHash(jv)
- }
- }
- return topics
-}