mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
libplugin: Add 'getmanifest' 'dynamic' field
This commit is contained in:
parent
f57f068592
commit
017ee7c916
@ -90,7 +90,7 @@ static const struct plugin_command commands[] = { {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
plugin_main(argv, init, commands, ARRAY_SIZE(commands),
|
||||
plugin_main(argv, init, PLUGIN_RESTARTABLE, commands, ARRAY_SIZE(commands),
|
||||
plugin_option("autocleaninvoice-cycle",
|
||||
"string",
|
||||
"Perform cleanup of expired invoices every"
|
||||
|
@ -473,7 +473,8 @@ static struct command_result *
|
||||
handle_getmanifest(struct command *getmanifest_cmd,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands,
|
||||
const struct plugin_option *opts)
|
||||
const struct plugin_option *opts,
|
||||
const enum plugin_restartability restartability)
|
||||
{
|
||||
struct json_out *params = json_out_new(tmpctx);
|
||||
|
||||
@ -501,6 +502,7 @@ handle_getmanifest(struct command *getmanifest_cmd,
|
||||
json_out_end(params, '}');
|
||||
}
|
||||
json_out_end(params, ']');
|
||||
json_out_addstr(params, "dynamic", restartability == PLUGIN_RESTARTABLE ? "true" : "false");
|
||||
json_out_end(params, '}');
|
||||
json_out_finished(params);
|
||||
|
||||
@ -699,6 +701,7 @@ void plugin_log(enum log_level l, const char *fmt, ...)
|
||||
|
||||
void plugin_main(char *argv[],
|
||||
void (*init)(struct plugin_conn *rpc),
|
||||
const enum plugin_restartability restartability,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands, ...)
|
||||
{
|
||||
@ -749,7 +752,7 @@ void plugin_main(char *argv[],
|
||||
plugin_err("Expected getmanifest not %s", cmd->methodname);
|
||||
|
||||
membuf_consume(&request_conn.mb, reqlen);
|
||||
handle_getmanifest(cmd, commands, num_commands, opts);
|
||||
handle_getmanifest(cmd, commands, num_commands, opts, restartability);
|
||||
|
||||
cmd = read_json_request(tmpctx, &request_conn, &rpc_conn,
|
||||
¶ms, &reqlen);
|
||||
|
@ -16,6 +16,11 @@ struct plugin_conn;
|
||||
|
||||
extern bool deprecated_apis;
|
||||
|
||||
enum plugin_restartability {
|
||||
PLUGIN_STATIC,
|
||||
PLUGIN_RESTARTABLE
|
||||
};
|
||||
|
||||
/* Create an array of these, one for each command you support. */
|
||||
struct plugin_command {
|
||||
const char *name;
|
||||
@ -148,6 +153,7 @@ char *charp_option(const char *arg, char **p);
|
||||
/* The main plugin runner: append with 0 or more plugin_option(), then NULL. */
|
||||
void NORETURN LAST_ARG_NULL plugin_main(char *argv[],
|
||||
void (*init)(struct plugin_conn *rpc),
|
||||
const enum plugin_restartability restartability,
|
||||
const struct plugin_command *commands,
|
||||
size_t num_commands, ...);
|
||||
#endif /* LIGHTNING_PLUGINS_LIBPLUGIN_H */
|
||||
|
@ -1311,5 +1311,5 @@ static const struct plugin_command commands[] = { {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
plugin_main(argv, init, commands, ARRAY_SIZE(commands), NULL);
|
||||
plugin_main(argv, init, PLUGIN_RESTARTABLE, commands, ARRAY_SIZE(commands), NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user