BROKEN: attempt to replace go-wire.JSON with json.Unmarshall in rpc

This commit is contained in:
Ethan Frey
2017-04-28 16:24:06 +02:00
parent bff8402fe8
commit 6c60c07f16
7 changed files with 77 additions and 52 deletions

View File

@ -8,9 +8,8 @@ import (
"github.com/gorilla/websocket"
"github.com/pkg/errors"
cmn "github.com/tendermint/tmlibs/common"
types "github.com/tendermint/tendermint/rpc/lib/types"
wire "github.com/tendermint/go-wire"
cmn "github.com/tendermint/tmlibs/common"
)
const (
@ -157,15 +156,15 @@ func (wsc *WSClient) Unsubscribe(eventid string) error {
func (wsc *WSClient) Call(method string, params map[string]interface{}) error {
// we need this step because we attempt to decode values using `go-wire`
// (handlers.go:470) on the server side
encodedParams := make(map[string]interface{})
for k, v := range params {
bytes := json.RawMessage(wire.JSONBytes(v))
encodedParams[k] = &bytes
}
// encodedParams := make(map[string]interface{})
// for k, v := range params {
// bytes := json.RawMessage(wire.JSONBytes(v))
// encodedParams[k] = &bytes
// }
err := wsc.WriteJSON(types.RPCRequest{
JSONRPC: "2.0",
Method: method,
Params: encodedParams,
Params: params,
ID: "",
})
return err