lightningd: correctly exit when an important-plugin fails to start.

This was found by tests/test_plugin.py::test_important_plugin and
was NOT a flake!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: only just committed
This commit is contained in:
Rusty Russell
2022-11-30 13:07:46 +10:30
committed by Christian Decker
parent 110ed3b1a9
commit 19300de58f
5 changed files with 18 additions and 7 deletions

View File

@@ -1938,7 +1938,7 @@ plugin_config(struct plugin *plugin)
plugin->plugin_state = AWAITING_INIT_RESPONSE;
}
void plugins_config(struct plugins *plugins)
bool plugins_config(struct plugins *plugins)
{
struct plugin *p;
list_for_each(&plugins->plugins, p, list) {
@@ -1948,10 +1948,15 @@ void plugins_config(struct plugins *plugins)
/* Wait for them to configure, before continuing: large
* nodes can take a while to startup! */
if (plugins->startup)
io_loop_with_timers(plugins->ld);
if (plugins->startup) {
/* This happens if an important plugin fails init,
* or if they call shutdown now. */
if (io_loop_with_timers(plugins->ld) == plugins->ld)
return false;
}
plugins->startup = false;
return true;
}
/** json_add_opt_plugins_array