From e5c61fcb0cd4120259945b31add72ef353daff2e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 17 Dec 2018 14:21:25 +1030 Subject: [PATCH] jsonrpc: plumb through dispatch result to avoid command_its_complicated(). Signed-off-by: Rusty Russell --- lightningd/jsonrpc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index 1ed2501f6..43d3d956c 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -1018,6 +1018,7 @@ static struct command_result *json_check(struct command *cmd, const jsmntok_t *name_tok; bool failed; struct json_stream *response; + struct command_result *res; if (cmd->mode == CMD_USAGE) { mod_params = NULL; @@ -1040,10 +1041,13 @@ static struct command_result *json_check(struct command *cmd, cmd->mode = CMD_CHECK; failed = false; tal_add_destructor2(cmd, destroy_command_canary, &failed); - cmd->json_cmd->dispatch(cmd, buffer, mod_params, mod_params); + res = cmd->json_cmd->dispatch(cmd, buffer, mod_params, mod_params); + + /* CMD_CHECK always makes it "fail" parameter parsing. */ + assert(res == ¶m_failed); if (failed) - return command_its_complicated(); + return res; response = json_stream_success(cmd); json_object_start(response, NULL);