From 98f64fb62335bd51731c2b4f2ffc9fcf31d0a72a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 21 Apr 2022 16:17:29 +0930 Subject: [PATCH] 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 --- lightningd/dual_open_control.c | 5 +++++ tests/test_connection.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index d7620dfce..d8ac12643 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -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); diff --git a/tests/test_connection.py b/tests/test_connection.py index 0351f1dd1..537b9ec3c 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -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): '''