diff --git a/lightningd/options.c b/lightningd/options.c index 83cffbeaa..d8c5d9cfa 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1278,8 +1278,9 @@ static void add_config(struct lightningd *ld, json_add_opt_plugins(response, ld->plugins); } else if (opt->cb_arg == (void *)opt_log_level) { json_add_opt_log_levels(response, ld->log); + } else if (opt->cb_arg == (void *)opt_disable_plugin) { + json_add_opt_disable_plugins(response, ld->plugins); } else if (opt->cb_arg == (void *)opt_add_plugin_dir - || opt->cb_arg == (void *)opt_disable_plugin || opt->cb_arg == (void *)plugin_opt_set || opt->cb_arg == (void *)plugin_opt_flag_set) { /* FIXME: We actually treat it as if they specified diff --git a/lightningd/plugin.c b/lightningd/plugin.c index b465afd0a..54e017c83 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -180,6 +180,7 @@ void plugin_blacklist(struct plugins *plugins, const char *name) { struct plugin *p, *next; + log_debug(plugins->log, "blacklist for %s", name); list_for_each_safe(&plugins->plugins, p, next, list) { if (plugin_paths_match(p->cmd, name)) { log_info(plugins->log, "%s: disabled via disable-plugin", @@ -1453,6 +1454,15 @@ void json_add_opt_plugins(struct json_stream *response, json_array_end(response); } +void json_add_opt_disable_plugins(struct json_stream *response, + const struct plugins *plugins) +{ + json_array_start(response, "disable-plugin"); + for (size_t i = 0; i < tal_count(plugins->blacklist); i++) + json_add_string(response, NULL, plugins->blacklist[i]); + json_array_end(response); +} + /** * Determine whether a plugin is subscribed to a given topic/method. */ diff --git a/lightningd/plugin.h b/lightningd/plugin.h index 63062bbf1..0b1442cec 100644 --- a/lightningd/plugin.h +++ b/lightningd/plugin.h @@ -274,6 +274,12 @@ void json_add_opt_plugins(struct json_stream *response, const struct plugins *plugins); +/** + * Add the disable-plugins options to listconfigs. + */ +void json_add_opt_disable_plugins(struct json_stream *response, + const struct plugins *plugins); + /** * Used by db hooks which can't have any other I/O while talking to plugin. * diff --git a/tests/test_plugin.py b/tests/test_plugin.py index a79674a6e..65dc9702a 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -322,6 +322,12 @@ def test_plugin_disable(node_factory): n.rpc.plugin_startdir(directory=os.path.join(os.getcwd(), "contrib/plugins")) n.daemon.wait_for_log('helloworld.py: disabled via disable-plugin') + # Check that list works + n = node_factory.get_node(options={'disable-plugin': + ['something-else.py', 'helloworld.py']}) + + assert n.rpc.listconfigs()['disable-plugin'] == ['something-else.py', 'helloworld.py'] + def test_plugin_hook(node_factory, executor): """The helloworld plugin registers a htlc_accepted hook.