From 333dcbf3736cec86080e5dc1e81fb067bd0d166f Mon Sep 17 00:00:00 2001 From: "ZmnSCPxj, ZmnSCPxj jxPCSmnZ" Date: Wed, 2 May 2018 10:53:34 +0800 Subject: [PATCH] lightningd: Move onchaind replay and gossipd activation after daemonization Fixes: #1445 Hacky fix, possibly. First cut at avoiding starting up onchaind and gossipd (which might make queries of chaintopology, which might start up a bitcoin-cli) before we can daemonize. --- lightningd/lightningd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 8ed43d178..dc9ce89bd 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -394,13 +394,6 @@ int main(int argc, char *argv[]) ld->config.poll_time, blockheight); - /* Activate gossip daemon. Needs to be after the initialization of - * chaintopology, otherwise we may be asking for uninitialized data. */ - gossip_activate(ld); - - /* Replay transactions for all running onchainds */ - onchaind_replay_channels(ld); - /* Create RPC socket (if any) */ setup_jsonrpc(ld, ld->rpc_filename); @@ -411,6 +404,13 @@ int main(int argc, char *argv[]) /* Create PID file */ pidfile_create(ld); + /* Activate gossip daemon. Needs to be after the initialization of + * chaintopology, otherwise we may be asking for uninitialized data. */ + gossip_activate(ld); + + /* Replay transactions for all running onchainds */ + onchaind_replay_channels(ld); + /* Mark ourselves live. */ log_info(ld->log, "Server started with public key %s, alias %s (color #%s) and lightningd %s", type_to_string(tmpctx, struct pubkey, &ld->id),