From 9361b62e3a5290f22cb30ffd129ee8e1aa4fadbc Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 25 Nov 2020 10:48:46 +1030 Subject: [PATCH] libplugin: add command_hook_success helper. Signed-off-by: Rusty Russell --- plugins/libplugin.c | 8 ++++++++ plugins/libplugin.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 1466a0aef..f82930bb5 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -1595,3 +1595,11 @@ struct route_hop *json_to_route(const tal_t *ctx, const char *buffer, } return hops; } + +struct command_result *WARN_UNUSED_RESULT +command_hook_success(struct command *cmd) +{ + struct json_stream *response = jsonrpc_stream_success(cmd); + json_add_string(response, "result", "continue"); + return command_finished(cmd, response); +} diff --git a/plugins/libplugin.h b/plugins/libplugin.h index 684c8a41a..d9b3fd540 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -186,6 +186,10 @@ command_success(struct command *cmd, const struct json_out *result); struct command_result *WARN_UNUSED_RESULT command_success_str(struct command *cmd, const char *str); +/* End a hook normally (with "result": "continue") */ +struct command_result *WARN_UNUSED_RESULT +command_hook_success(struct command *cmd); + /* Synchronous helper to send command and extract single field from * response; can only be used in init callback. */ const char *rpc_delve(const tal_t *ctx,