From d9ea2e6b454ee564bb44738e69d023ab4d3cb834 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 3 Sep 2018 15:44:15 +0200 Subject: [PATCH] master: Move JSON-RPC setup below PID-file creation If we run two daemons on the same directory we'd be getting the failure from trying to listen to the same file before we'd hit the pid-file error, which was causing confusion. --- lightningd/lightningd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 6d09f1e97..6a02d2b70 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -664,10 +664,6 @@ int main(int argc, char *argv[]) setup_topology(ld->topology, &ld->timers, min_blockheight, max_blockheight); - /*~ Create RPC socket: now lightning-cli can send us JSON RPC commands - * over a UNIX domain socket specified by `ld->rpc_filename`. */ - setup_jsonrpc(ld, ld->rpc_filename); - /*~ 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 @@ -679,6 +675,10 @@ int main(int argc, char *argv[]) * changes our pid! */ pidfile_create(ld); + /*~ Create RPC socket: now lightning-cli can send us JSON RPC commands + * over a UNIX domain socket specified by `ld->rpc_filename`. */ + setup_jsonrpc(ld, ld->rpc_filename); + /*~ Activate connect daemon. Needs to be after the initialization of * chaintopology, otherwise peers may connect and ask for * uninitialized data. */