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.
This commit is contained in:
ZmnSCPxj, ZmnSCPxj jxPCSmnZ 2018-05-02 10:53:34 +08:00 committed by Christian Decker
parent c6af2a8cb2
commit 333dcbf373

View File

@ -394,13 +394,6 @@ int main(int argc, char *argv[])
ld->config.poll_time, ld->config.poll_time,
blockheight); 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) */ /* Create RPC socket (if any) */
setup_jsonrpc(ld, ld->rpc_filename); setup_jsonrpc(ld, ld->rpc_filename);
@ -411,6 +404,13 @@ int main(int argc, char *argv[])
/* Create PID file */ /* Create PID file */
pidfile_create(ld); 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. */ /* Mark ourselves live. */
log_info(ld->log, "Server started with public key %s, alias %s (color #%s) and lightningd %s", 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), type_to_string(tmpctx, struct pubkey, &ld->id),