diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 3ca0f3d2a..38acdbfb5 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -180,6 +180,9 @@ static void check_plugins_initted(struct plugins *plugins) for (size_t i = 0; i < tal_count(plugin_cmds); i++) plugin_cmd_all_complete(plugins, plugin_cmds[i]); tal_free(plugin_cmds); + + if (plugins->startup) + io_break(plugins); } struct command_result *plugin_register_all_complete(struct lightningd *ld, @@ -1943,6 +1946,11 @@ void plugins_config(struct plugins *plugins) plugin_config(p); } + /* Wait for them to configure, before continuing: large + * nodes can take a while to startup! */ + if (plugins->startup) + io_loop_with_timers(plugins->ld); + plugins->startup = false; } diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 91474de2c..98ddec31b 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1942,6 +1942,8 @@ def test_plugin_fail(node_factory): time.sleep(2) # It should clean up! assert 'failcmd' not in [h['command'] for h in l1.rpc.help()['help']] + # Can happen *before* the 'Server started with public key' + l1.daemon.logsearch_start = 0 l1.daemon.wait_for_log(r': exited during normal operation') l1.rpc.plugin_start(plugin)