diff --git a/lightningd/plugin_control.c b/lightningd/plugin_control.c index b4f6ec1a0..2f8bb4ed0 100644 --- a/lightningd/plugin_control.c +++ b/lightningd/plugin_control.c @@ -156,6 +156,8 @@ plugin_dynamic_stop(struct command *cmd, const char *plugin_name) "%s cannot be managed when " "lightningd is up", plugin_name); + /* Don't freak out, even if it's a built-in */ + p->important = false; /* If it's interested in clean shutdown, tell it. */ if (notify_plugin_shutdown(cmd->ld, p)) { diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 725a2d638..4a893cdc6 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -4450,6 +4450,15 @@ def test_listchannels_broken_message(node_factory): l1.rpc.listchannels() +def test_important_plugin_shutdown(node_factory): + """We can shutdown an important plugin (as long as it's dynamic) without dying""" + + l1 = node_factory.get_node() + + l1.rpc.plugin_stop("pay") + l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/pay')) + + @unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.") def test_exposesecret(node_factory): l1, l2 = node_factory.get_nodes(2, opts=[{'exposesecret-passphrase': "test_exposesecret"}, {}])