mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 07:14:36 +01:00
jsonrpc: plumb through dispatch result to avoid command_its_complicated().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user