lightningd: don't create rpc socket & listening socket until topology known.

We can deref a NULL tip pointer otherwise.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-08-09 13:11:24 +09:30
parent 35f83841da
commit 4563ff91e9

View File

@ -336,12 +336,6 @@ int main(int argc, char *argv[])
check_bitcoind_config(dstate);
/* Create RPC socket (if any) */
setup_jsonrpc(dstate, dstate->rpc_filename);
/* Set up connections from peers. */
setup_listeners(dstate, portnum);
/* Set up node ID and private key. */
secrets_init(dstate);
new_node(dstate, &dstate->id);
@ -349,6 +343,12 @@ int main(int argc, char *argv[])
/* Initialize block topology. */
setup_topology(dstate);
/* Create RPC socket (if any) */
setup_jsonrpc(dstate, dstate->rpc_filename);
/* Set up connections from peers. */
setup_listeners(dstate, portnum);
/* Make sure we use the artificially-controlled time for timers */
io_time_override(controlled_time);