jsonrpc: don't be coy with details for command_its_complicated().

Obviously the Facebook relationship status joke was a bit subtle, but I've
continued it anyway because I'm especially susceptible to Dad jokes.

Suggested-by: @niftynei
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-12-17 14:22:08 +10:30
parent 26484b8aa5
commit add822a072
6 changed files with 27 additions and 15 deletions

View File

@ -572,7 +572,10 @@ static struct command_result *json_waitanyinvoice(struct command *cmd,
wallet_invoice_waitany(cmd, wallet, *pay_index,
&wait_on_invoice, (void*) cmd);
return command_its_complicated();
return command_its_complicated("wallet_invoice_waitany might complete"
" immediately, but we also call it as a"
" callback so plumbing through the return"
" is non-trivial.");
}
static const struct json_command waitanyinvoice_command = {
@ -616,7 +619,8 @@ static struct command_result *json_waitinvoice(struct command *cmd,
fixme_ignore(command_still_pending(cmd));
wallet_invoice_waitone(cmd, wallet, i,
&wait_on_invoice, (void *) cmd);
return command_its_complicated();
return command_its_complicated("wallet_invoice_waitone might"
" complete immediately");
}
}

View File

@ -57,7 +57,8 @@ struct command_result *command_param_failed(void)
return &param_failed;
}
struct command_result *command_its_complicated(void)
struct command_result *command_its_complicated(const char *relationship_details
UNNEEDED)
{
return &unknown;
}

View File

@ -127,7 +127,7 @@ static inline void fixme_ignore(const struct command_result *res)
}
/* FIXME: For the few cases where return value is indeterminate */
struct command_result *command_its_complicated(void);
struct command_result *command_its_complicated(const char *why);
/**
* Create a new jsonrpc to wrap all related information.

View File

@ -1013,7 +1013,8 @@ static struct command_result *json_sendpay(struct command *cmd,
description,
&json_sendpay_on_resolve, cmd))
return command_still_pending(cmd);
return command_its_complicated();
return command_its_complicated("send_payment is called in multiple paths,"
" patching return value through is hard");
}
static const struct json_command sendpay_command = {
@ -1044,7 +1045,9 @@ static struct command_result *json_waitsendpay(struct command *cmd,
return command_param_failed();
if (!wait_payment(cmd, cmd->ld, rhash, &json_waitsendpay_on_resolve, cmd))
return command_its_complicated();
return command_its_complicated("wait_payment called in multiple"
" paths, patching return value"
" through is hard");
if (timeout)
new_reltimer(&cmd->ld->timers, cmd, time_from_sec(*timeout),

View File

@ -47,20 +47,24 @@ struct command_result *command_fail(struct command *cmd UNNEEDED, int code UNNEE
{ fprintf(stderr, "command_fail called!\n"); abort(); }
/* Generated stub for command_failed */
struct command_result *command_failed(struct command *cmd UNNEEDED,
struct json_stream *result UNNEEDED)
struct json_stream *result)
{ fprintf(stderr, "command_failed called!\n"); abort(); }
/* Generated stub for command_its_complicated */
struct command_result *command_its_complicated(void)
struct command_result *command_its_complicated(const char *why UNNEEDED)
{ 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)
struct command_result *command_still_pending(struct command *cmd)
{ fprintf(stderr, "command_still_pending called!\n"); abort(); }
/* Generated stub for command_success */
struct command_result *command_success(struct command *cmd UNNEEDED,
struct json_stream *response UNNEEDED)
struct json_stream *response)
{ fprintf(stderr, "command_success called!\n"); abort(); }
/* Generated stub for connect_succeeded */
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)

View File

@ -55,18 +55,18 @@ struct command_result *command_fail(struct command *cmd UNNEEDED, int code UNNEE
const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "command_fail 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)
struct command_result *command_still_pending(struct command *cmd)
{ fprintf(stderr, "command_still_pending called!\n"); abort(); }
/* Generated stub for command_success */
struct command_result *command_success(struct command *cmd UNNEEDED,
struct json_stream *response UNNEEDED)
struct json_stream *response)
{ fprintf(stderr, "command_success called!\n"); abort(); }
/* Generated stub for connect_succeeded */
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)