mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +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:
@@ -65,7 +65,7 @@ static struct connect *find_connect(struct lightningd *ld,
|
||||
|
||||
static void connect_cmd_succeed(struct command *cmd, const struct pubkey *id)
|
||||
{
|
||||
struct json_result *response = new_json_result(cmd);
|
||||
struct json_result *response = json_stream_success(cmd);
|
||||
json_object_start(response, NULL);
|
||||
json_add_pubkey(response, "id", id);
|
||||
json_object_end(response);
|
||||
|
||||
Reference in New Issue
Block a user