Browse Source

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
```
pull/456/head
Anton Kaliaev 8 years ago
parent
commit
fed84f875c
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      server/handlers.go

+ 2
- 2
server/handlers.go View File

@ -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…
Cancel
Save