Skip to content

Commit c93153e

Browse files
committed
lightningd: allow builtin plugins to be stopped.
These are automatically marked "important", in the sense that we won't startup if they are not working, but this wasn't meant to disallow stopping them. Changelog-Changed: JSON-RPC: built-in plugins can now be stopped using "plugin stop". Signed-off-by: Rusty Russell <[email protected]>
1 parent 41e15b1 commit c93153e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lightningd/plugin_control.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ plugin_dynamic_stop(struct command *cmd, const char *plugin_name)
156156
"%s cannot be managed when "
157157
"lightningd is up",
158158
plugin_name);
159+
/* Don't freak out, even if it's a built-in */
160+
p->important = false;
159161

160162
/* If it's interested in clean shutdown, tell it. */
161163
if (notify_plugin_shutdown(cmd->ld, p)) {

tests/test_plugin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4450,6 +4450,15 @@ def test_listchannels_broken_message(node_factory):
44504450
l1.rpc.listchannels()
44514451

44524452

4453+
def test_important_plugin_shutdown(node_factory):
4454+
"""We can shutdown an important plugin (as long as it's dynamic) without dying"""
4455+
4456+
l1 = node_factory.get_node()
4457+
4458+
l1.rpc.plugin_stop("pay")
4459+
l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/pay'))
4460+
4461+
44534462
@unittest.skipIf(VALGRIND, "It does not play well with prompt and key derivation.")
44544463
def test_exposesecret(node_factory):
44554464
l1, l2 = node_factory.get_nodes(2, opts=[{'exposesecret-passphrase': "test_exposesecret"}, {}])

0 commit comments

Comments
 (0)