From 5917f1599d9b94127a976e42b26ac8bd2588d71b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Dec 2023 10:46:16 +1030 Subject: [PATCH] pytest: check that listpeerchannels gives the same channel type as returned from fund/openchannel Could have done this in an earlier commit, but that would be a messy rebase. Signed-off-by: Rusty Russell --- tests/test_opening.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_opening.py b/tests/test_opening.py index 47aa4cf09c39..fbddd05fb08e 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -2614,6 +2614,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind): ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT, channel_type=ctype + zeroconf) assert ret['channel_type']['bits'] == ctype + zeroconf + assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype + zeroconf + # Note: l2 doesn't show it in listpeerchannels yet... l1.rpc.fundchannel_cancel(l2.info['id']) # Zeroconf is refused to l4. @@ -2627,6 +2629,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind): for ctype in ([STATIC_REMOTEKEY], [STATIC_REMOTEKEY, ANCHORS_ZERO_FEE_HTLC_TX]): ret = l1.rpc.openchannel_init(l3.info['id'], FUNDAMOUNT - 1000, psbt, channel_type=ctype) assert ret['channel_type']['bits'] == ctype + assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype + assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype l1.rpc.openchannel_abort(ret['channel_id']) # Old anchors not supported for new channels @@ -2660,6 +2664,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind): ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT, channel_type=[STATIC_REMOTEKEY, ANCHORS_OLD]) assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD] + assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD] + # Note: l3 doesn't show it in listpeerchannels yet... l1.rpc.fundchannel_cancel(l2.info['id']) l1.rpc.unreserveinputs(psbt) @@ -2667,6 +2673,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind): # Works with fundchannel / multifundchannel ret = l1.rpc.fundchannel(l2.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY]) assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY] + assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY] + assert only_one(l2.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY] # FIXME: Check type is actually correct! # Mine that so we can spend change. @@ -2676,3 +2684,5 @@ def test_opening_explicit_channel_type(node_factory, bitcoind): l1.connect(l3) ret = l1.rpc.fundchannel(l3.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY]) assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY] + assert only_one(l1.rpc.listpeerchannels(l3.info['id'])['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY] + assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]