mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 09:34:24 +01:00
jsonrpc: declare up front whether a response is success or fail.
Such an API is required for when we stream it directly. Almost all our handlers fit this pattern already, or nearly do. We remove new_json_result() in favor of explicit json_stream_success() and json_stream_fail(), but still allowing command_fail() if you just want a simple all-in-one fail wrapper. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -30,18 +30,6 @@ void command_fail(struct command *cmd, int code, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void command_fail_detailed(struct command *cmd, int code,
|
||||
const struct json_result *data, const char *fmt, ...)
|
||||
{
|
||||
failed = true;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
fail_msg = tal_vfmt(cmd, fmt, ap);
|
||||
fail_msg =
|
||||
tal_fmt(cmd, "%s data: %s", fail_msg, json_result_string(data));
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for feerate_from_style */
|
||||
u32 feerate_from_style(u32 feerate UNNEEDED, enum feerate_style style UNNEEDED)
|
||||
|
||||
Reference in New Issue
Block a user