From 4ad8f1035b41260aafc5a20218333403bb271090 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 14 May 2015 12:17:19 -0500 Subject: Format contract code as hexdata --- rpc/api.go | 1 + 1 file changed, 1 insertion(+) (limited to 'rpc') diff --git a/rpc/api.go b/rpc/api.go index 066c81222..b59253ef7 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -349,6 +349,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err if err != nil { return err } + contract.Code = newHexData(contract.Code).String() *reply = contract case "eth_newFilter": -- cgit v1.2.3 From 5c6540452ac49db3defdfa1e141b4acf8eaaaad7 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 14 May 2015 12:39:57 -0500 Subject: Omit replies for notification requests When Id is missing, the client does not want a response --- rpc/http.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'rpc') diff --git a/rpc/http.go b/rpc/http.go index c5bb10c80..9220c730c 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -87,7 +87,9 @@ func JSONRPC(pipe *xeth.XEth) http.Handler { var reqSingle RpcRequest if err := json.Unmarshal(body, &reqSingle); err == nil { response := RpcResponse(api, &reqSingle) - send(w, &response) + if reqSingle.Id != nil { + send(w, &response) + } return } @@ -96,11 +98,28 @@ func JSONRPC(pipe *xeth.XEth) http.Handler { if err := json.Unmarshal(body, &reqBatch); err == nil { // Build response batch resBatch := make([]*interface{}, len(reqBatch)) + resCount := 0 + for i, request := range reqBatch { response := RpcResponse(api, &request) - resBatch[i] = response + // this leaves nil entries in the response batch for later removal + if request.Id != nil { + resBatch[i] = response + resCount = resCount + 1 + } } - send(w, resBatch) + + // make response omitting nil entries + respBatchComp := make([]*interface{}, resCount) + resCount = resCount - 1 + for _, v := range resBatch { + if v != nil { + respBatchComp[resCount] = v + resCount = resCount - 1 + } + } + + send(w, respBatchComp) return } -- cgit v1.2.3 From 44a7f997c3c2743634e3fe9db2ead1b8b6a02778 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 14 May 2015 15:50:39 -0500 Subject: Unreverse ordering --- rpc/http.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'rpc') diff --git a/rpc/http.go b/rpc/http.go index 9220c730c..9b3fa5142 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -111,10 +111,9 @@ func JSONRPC(pipe *xeth.XEth) http.Handler { // make response omitting nil entries respBatchComp := make([]*interface{}, resCount) - resCount = resCount - 1 for _, v := range resBatch { if v != nil { - respBatchComp[resCount] = v + respBatchComp[len(respBatchComp)-resCount] = v resCount = resCount - 1 } } -- cgit v1.2.3