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.
This commit is contained in:
Christian Decker 2018-09-03 15:44:15 +02:00
parent dc88c35d7f
commit d9ea2e6b45
1 changed files with 4 additions and 4 deletions

View File

@ -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. */