json-rpc: make commands return 'struct command_result *'.

Usually, this means they return 'command_param_failed()' if param()
fails, and changing 'command_success(); return;' to 'return
command_success()'.

Occasionally, it's more complex: there's a command_its_complicated()
for the case where we can't exactly determine what the status is,
but it should be considered a last resort.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-12-16 15:22:06 +10:30
parent 1ede7bc55b
commit 68bb36b210
19 changed files with 516 additions and 539 deletions

View File

@@ -49,6 +49,12 @@ struct command_result *command_fail(struct command *cmd UNNEEDED, int code UNNEE
struct command_result *command_failed(struct command *cmd UNNEEDED,
struct json_stream *result UNNEEDED)
{ fprintf(stderr, "command_failed called!\n"); abort(); }
/* Generated stub for command_its_complicated */
struct command_result *command_its_complicated(void)
{ fprintf(stderr, "command_its_complicated called!\n"); abort(); }
/* Generated stub for command_param_failed */
struct command_result *command_param_failed(void)
{ fprintf(stderr, "command_param_failed called!\n"); abort(); }
/* Generated stub for command_still_pending */
struct command_result *command_still_pending(struct command *cmd UNNEEDED)
{ fprintf(stderr, "command_still_pending called!\n"); abort(); }