Skip to content

Commit

Permalink
Correct JSON-RPC passthrough parameters
Browse files Browse the repository at this point in the history
The previous code would pass all parameters (including null and the
empty array) as the first parameter to all passthrough requests.
  • Loading branch information
jrick committed Aug 20, 2019
1 parent f02a71b commit db455a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rpc/jsonrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ func lazyApplyHandler(s *Server, ctx context.Context, request *dcrjson.Request)
return nil, rpcErrorf(dcrjson.ErrRPCClientNotConnected, "RPC passthrough requires dcrd RPC synchronization")
}
var resp json.RawMessage
err := rpc.Call(ctx, request.Method, &resp, request.Params)
var params = make([]interface{}, len(request.Params))
for i := range request.Params {
params[i] = request.Params[i]
}
err := rpc.Call(ctx, request.Method, &resp, params...)
if ctx.Err() != nil {
log.Warnf("Canceled RPC method %v invoked by %v: %v", request.Method, remoteAddr(ctx), err)
return nil, &dcrjson.RPCError{
Expand Down

0 comments on commit db455a3

Please sign in to comment.