From d790229a33b1f3e6256ca6916be17a0cc3663076 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 25 Jan 2015 14:50:43 -0600 Subject: Move HTTP transport to sub package of RPC --- rpc/packages.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'rpc/packages.go') diff --git a/rpc/packages.go b/rpc/packages.go index e87e0db7c..8b5965069 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -33,6 +33,15 @@ import ( "github.com/ethereum/go-ethereum/xeth" ) +type RpcServer interface { + Start() + Stop() +} + +func NewEthereumApi(xeth *xeth.JSXEth) *EthereumApi { + return &EthereumApi{pipe: xeth} +} + type EthereumApi struct { pipe *xeth.JSXEth } @@ -103,7 +112,7 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *interface{}) err i, _ := new(big.Int).SetString(args.Key, 10) hx = ethutil.Bytes2Hex(i.Bytes()) } - jsonlogger.Debugf("GetStorageAt(%s, %s)\n", args.Address, hx) + rpclogger.Debugf("GetStorageAt(%s, %s)\n", args.Address, hx) value := state.Storage(ethutil.Hex2Bytes(hx)) *reply = GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value.Str()} return nil @@ -159,7 +168,7 @@ func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error { func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error { // Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC - jsonlogger.DebugDetailf("%T %s", req.Params, req.Params) + rpclogger.DebugDetailf("%T %s", req.Params, req.Params) switch req.Method { case "eth_coinbase": return p.GetCoinbase(reply) @@ -203,6 +212,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return NewErrorResponse(ErrorNotImplemented) } - jsonlogger.DebugDetailf("Reply: %T %s", reply, reply) + rpclogger.DebugDetailf("Reply: %T %s", reply, reply) return nil } -- cgit