diff --git a/geth/api/backend_test.go b/geth/api/backend_test.go index 8160ad727..70597d6ea 100644 --- a/geth/api/backend_test.go +++ b/geth/api/backend_test.go @@ -199,15 +199,6 @@ func (s *BackendTestSuite) TestCallRPC() { progress <- struct{}{} }, }, - { - `{"jsonrpc":"2.0","method":"net_version","params":[]}`, // w/o id - func(resultJSON string) { - expected := `{"jsonrpc":"2.0","id":1,"result":"4"}` + "\n" - s.Equal(expected, resultJSON) - s.T().Log("net_version: ", resultJSON) - progress <- struct{}{} - }, - }, { `{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}`, func(resultJSON string) { diff --git a/geth/node/rpc.go b/geth/node/rpc.go index 2d2a831f2..cdb0a12eb 100644 --- a/geth/node/rpc.go +++ b/geth/node/rpc.go @@ -16,7 +16,6 @@ import ( const ( jsonrpcVersion = "2.0" - serviceMethodSeparator = "_" ) type jsonRequest struct { @@ -69,12 +68,6 @@ func (c *RPCManager) Call(inputJSON string) string { // allow HTTP requests to block w/o outputJSON := make(chan string, 1) go func() { - inputJSON, err = c.prepare(inputJSON) - if err != nil { - outputJSON <- c.makeJSONErrorResponse(err) - return - } - httpReq := httptest.NewRequest("POST", "/", strings.NewReader(inputJSON)) rr := httptest.NewRecorder() server.ServeHTTP(rr, httpReq) @@ -101,34 +94,6 @@ func (c *RPCManager) Call(inputJSON string) string { return c.makeJSONErrorResponse(ErrRPCServerTimeout) } -// prepare applies necessary transformations to incoming JSON -func (c *RPCManager) prepare(inputJSON string) (string, error) { - var in jsonRequest - if err := json.Unmarshal(json.RawMessage(inputJSON), &in); err != nil { - return inputJSON, err - } - - elems := strings.Split(in.Method, serviceMethodSeparator) - if len(elems) != 2 { - return inputJSON, ErrInvalidMethod - } - - // inject next ID - if in.ID == 0 { - c.Lock() - c.requestID++ - c.Unlock() - in.ID = c.requestID - } - - outputJSON, err := json.Marshal(&in) - if err != nil { - return inputJSON, err - } - - return string(outputJSON), nil -} - // makeJSONErrorResponse returns error as JSON response func (c *RPCManager) makeJSONErrorResponse(err error) string { response := jsonErrResponse{ diff --git a/geth/node/rpc_test.go b/geth/node/rpc_test.go index 4a9cb0bb7..ebe522e7f 100644 --- a/geth/node/rpc_test.go +++ b/geth/node/rpc_test.go @@ -82,15 +82,6 @@ func (s *RPCTestSuite) TestCallRPC() { progress <- struct{}{} }, }, - { - `{"jsonrpc":"2.0","method":"net_version","params":[]}`, // w/o id - func(resultJSON string) { - expected := `{"jsonrpc":"2.0","id":1,"result":"4"}` + "\n" - s.Equal(expected, resultJSON) - s.T().Log("net_version: ", resultJSON) - progress <- struct{}{} - }, - }, { `{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}`, func(resultJSON string) {