From 75989342b07c4b4a0c3df163889bd53dc67c16ae Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 4 May 2017 23:03:42 -0400 Subject: [PATCH] fixes from rebase --- rpc/core/routes.go | 6 ------ rpc/lib/server/handlers.go | 2 +- rpc/test/client_test.go | 7 ++++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/rpc/core/routes.go b/rpc/core/routes.go index 5e045d49d..734d1ee77 100644 --- a/rpc/core/routes.go +++ b/rpc/core/routes.go @@ -2,12 +2,6 @@ package core import ( rpc "github.com/tendermint/tendermint/rpc/lib/server" - - data "github.com/tendermint/go-wire/data" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - rpc "github.com/tendermint/tendermint/rpc/lib/server" - "github.com/tendermint/tendermint/rpc/lib/types" - "github.com/tendermint/tendermint/types" ) // TODO: better system than "unsafe" prefix diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index f780fba44..5e6252d43 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -145,7 +145,7 @@ func mapParamsToArgs(rpcFunc *RPCFunc, params map[string]*json.RawMessage, argsO for i, argName := range rpcFunc.argNames { argType := rpcFunc.args[i+argsOffset] - if p, ok := params[argName]; ok && len(*p) > 0 { + if p, ok := params[argName]; ok && p != nil && len(*p) > 0 { val := reflect.New(argType) err := json.Unmarshal(*p, val.Interface()) if err != nil { diff --git a/rpc/test/client_test.go b/rpc/test/client_test.go index ecc2f36b9..b7df67841 100644 --- a/rpc/test/client_test.go +++ b/rpc/test/client_test.go @@ -43,7 +43,7 @@ func testStatus(t *testing.T, client rpc.HTTPClient) { result := new(ctypes.ResultStatus) _, err := client.Call("status", map[string]interface{}{}, result) require.Nil(t, err) - assert.Equal(t, moniker, status.NodeInfo.Moniker) + assert.Equal(t, moniker, result.NodeInfo.Moniker) } //-------------------------------------------------------------------------------- @@ -158,8 +158,9 @@ func TestURITx(t *testing.T) { testTx(t, GetURIClient(), true) core.SetTxIndexer(&null.TxIndex{}) - testTx(t, GetJSONClient(), false) - core.SetTxIndexer(node.ConsensusState().GetState().TxIndexer) + defer core.SetTxIndexer(node.ConsensusState().GetState().TxIndexer) + + testTx(t, GetURIClient(), false) } func TestJSONTx(t *testing.T) {