lightningd: don't crash listpeers if we're opening DF channel.

We call out to connectd to activate the peer, and while we do that,
channel->owner is NULL.  A better pattern would be to set up the unsaved
channel once connectd has given us the peer, but this works for now.

Fixes: #5204
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-04-21 16:17:29 +09:30
parent f6e7d0c5dc
commit 98f64fb623
2 changed files with 6 additions and 1 deletions

View File

@ -120,6 +120,11 @@ void json_add_unsaved_channel(struct json_stream *response,
if (!channel->open_attempt)
return;
/* If we're calling out to connectd to activate peer to start the
* process, this will be NULL */
if (!channel->owner)
return;
oa = channel->open_attempt;
json_object_start(response, NULL);

View File

@ -1798,7 +1798,7 @@ def test_multifunding_simple(node_factory, bitcoind):
l1.rpc.pay(inv)
@pytest.mark.xfail(strict=True)
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_listpeers_crash(node_factory, bitcoind, executor):
'''