aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/args.go18
-rw-r--r--rpc/http/server.go8
2 files changed, 19 insertions, 7 deletions
diff --git a/rpc/args.go b/rpc/args.go
index e839da8bf..ea8489585 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -197,7 +197,7 @@ type FilterOptions struct {
Earliest int64
Latest int64
Address interface{}
- Topic []string
+ Topic []interface{}
Skip int
Max int
}
@@ -220,10 +220,20 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions {
opts.Earliest = options.Earliest
opts.Latest = options.Latest
- opts.Topics = make([][]byte, len(options.Topic))
- for i, topic := range options.Topic {
- opts.Topics[i] = fromHex(topic)
+
+ topics := make([][][]byte, len(options.Topic))
+ for i, topicDat := range options.Topic {
+ if slice, ok := topicDat.([]interface{}); ok {
+ topics[i] = make([][]byte, len(slice))
+ for j, topic := range slice {
+ topics[i][j] = fromHex(topic.(string))
+ }
+ } else if str, ok := topicDat.(string); ok {
+ topics[i] = make([][]byte, 1)
+ topics[i][0] = fromHex(str)
+ }
}
+ opts.Topics = topics
return opts
}
diff --git a/rpc/http/server.go b/rpc/http/server.go
index fa66eed48..452b7c9af 100644
--- a/rpc/http/server.go
+++ b/rpc/http/server.go
@@ -29,8 +29,8 @@ import (
var rpchttplogger = logger.NewLogger("RPC-HTTP")
var JSON rpc.JsonWrapper
-func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) {
- sport := fmt.Sprintf("127.0.0.1:%d", port)
+func NewRpcHttpServer(pipe *xeth.XEth, address string, port int) (*RpcHttpServer, error) {
+ sport := fmt.Sprintf("%s:%d", address, port)
l, err := net.Listen("tcp", sport)
if err != nil {
return nil, err
@@ -41,6 +41,7 @@ func NewRpcHttpServer(pipe *xeth.XEth, port int) (*RpcHttpServer, error) {
quit: make(chan bool),
pipe: pipe,
port: port,
+ addr: address,
}, nil
}
@@ -49,6 +50,7 @@ type RpcHttpServer struct {
listener net.Listener
pipe *xeth.XEth
port int
+ addr string
}
func (s *RpcHttpServer) exitHandler() {
@@ -69,7 +71,7 @@ func (s *RpcHttpServer) Stop() {
}
func (s *RpcHttpServer) Start() {
- rpchttplogger.Infof("Starting RPC-HTTP server on port %d", s.port)
+ rpchttplogger.Infof("Starting RPC-HTTP server on %s:%d", s.addr, s.port)
go s.exitHandler()
api := rpc.NewEthereumApi(s.pipe)