lightningd: add initializing state.

Importantly, the code in jsonrpc.c which actually does the io_break:

```
	/* Once the stop_conn conn is drained, we can shut down. */
	if (jcon->ld->stop_conn == conn && jcon->ld->state == LD_STATE_RUNNING) {
		/* Return us to toplevel lightningd.c */
		log_debug(jcon->ld->log, "io_break: %s", __func__);
		io_break(jcon->ld);
```

By having the state not set until later, we avoid running this.  Of course,
we need to avoid calling the main loop when we get there, if we've already
been told to shutdown.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-06 09:48:50 +09:30
committed by Vincenzo Palazzo
parent 30335e1dc3
commit 45193db7ea
3 changed files with 13 additions and 10 deletions

View File

@@ -3239,7 +3239,6 @@ def test_create_gossip_mesh(node_factory, bitcoind):
assert False, "Test failed on purpose, grab the gossip store from /tmp/ltests-..."
@pytest.mark.xfail(strict=True)
def test_fast_shutdown(node_factory):
l1 = node_factory.get_node(start=False)