fix jsonParamsToArgsWS index error
Error from tendermint: ``` panic: runtime error: index out of range goroutine 82 [running]: github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.jsonParamsToArgsWS(0xc4200960e0, 0xc42024d4a0, 0xc420215380, 0x3, 0x0, 0x0, 0xc420215383, 0x9, 0xc42024d4a0, 0xf1ecc0, ...) /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:184 +0x654 github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.(*wsConnection).readRoutine(0xc4201fd0e0) /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:496 +0x3a9 created by github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.(*wsConnection).OnStart /home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:377 +0x45 ```
This commit is contained in:
parent
1842e03315
commit
fed84f875c
|
@ -176,7 +176,7 @@ func indexOf(value string, values []string) int {
|
|||
|
||||
// Same as above, but with the first param the websocket connection
|
||||
func jsonParamsToArgsWS(rpcFunc *RPCFunc, params map[string]interface{}, wsCtx types.WSRPCContext) ([]reflect.Value, error) {
|
||||
values := make([]reflect.Value, len(rpcFunc.args))
|
||||
values := make([]reflect.Value, len(rpcFunc.args)+1)
|
||||
values[0] = reflect.ValueOf(wsCtx)
|
||||
|
||||
// fill each value with default
|
||||
|
@ -189,7 +189,7 @@ func jsonParamsToArgsWS(rpcFunc *RPCFunc, params map[string]interface{}, wsCtx t
|
|||
if -1 == i {
|
||||
return nil, fmt.Errorf("%s is not an argument (args: %v)", name, rpcFunc.argNames)
|
||||
}
|
||||
argType := rpcFunc.args[i+1]
|
||||
argType := rpcFunc.args[i]
|
||||
v, err := _jsonObjectToArg(argType, param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue