From 1368ac7f3cec267c8a4cc87f8c57f10d367b9fc3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 10 Dec 2018 15:09:42 +1030 Subject: [PATCH] lightningd: only initialize plugins once we're ready for them to connect. Signed-off-by: Rusty Russell --- lightningd/lightningd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index d300c1a74..6ec4c2437 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -616,11 +616,6 @@ int main(int argc, char *argv[]) /*~ Handle options and config; move to .lightningd (--lightning-dir) */ handle_opts(ld, argc, argv); - /*~ Now that we have collected all the early options, gave - * plugins a chance to register theirs and collected all - * remaining options it's time to tell the plugins. */ - plugins_config(ld->plugins); - /*~ Make sure we can reach the subdaemons, and versions match. */ test_subdaemons(ld); @@ -715,6 +710,10 @@ int main(int argc, char *argv[]) * over a UNIX domain socket specified by `ld->rpc_filename`. */ jsonrpc_listen(ld->jsonrpc, ld); + /*~ Now that the rpc path exists, we can start the plugins and they + * can start talking to us. */ + plugins_config(ld->plugins); + /*~ We defer --daemon until we've completed most initialization: that * way we'll exit with an error rather than silently exiting 0, then * realizing we can't start and forcing the confused user to read the