From bf89d86ba8e4529c49a1fcbeacb811c5ff925a36 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 22 Nov 2018 23:52:47 +0100 Subject: [PATCH] plugin: Plugins need a list of methods they registered This will be used in the next commit to dispatch calls to the correct plugin. Signed-off-by: Christian Decker <@cdecker> --- lightningd/plugin.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index b85d7559d..cf5981219 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -33,6 +33,8 @@ struct plugin { struct list_head plugin_opts; struct list_node list; + + const char **methods; }; struct plugin_request { @@ -106,6 +108,7 @@ void plugin_register(struct plugins *plugins, const char* path TAKES) plugin_count++; p->log = new_log(p, plugins->log_book, "plugin-%zu", plugin_count); p->log = plugins->log; + p->methods = tal_arr(p, const char *, 0); list_head_init(&p->plugin_opts); } @@ -460,6 +463,7 @@ static bool plugin_rpcmethod_add(struct plugin *plugin, const char *buffer, cmd->name); return false; } + *tal_arr_expand(&plugin->methods) = cmd->name; return true; }