Skip to content

Commit 2b7667f

Browse files
committed
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 <rusty@rustcorp.com.au>
1 parent ba016fe commit 2b7667f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_opening.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26062606
ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT,
26072607
channel_type=ctype + zeroconf)
26082608
assert ret['channel_type']['bits'] == ctype + zeroconf
2609+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype + zeroconf
2610+
# Note: l2 doesn't show it in listpeerchannels yet...
26092611
l1.rpc.fundchannel_cancel(l2.info['id'])
26102612

26112613
# Zeroconf is refused to l4.
@@ -2619,6 +2621,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26192621
for ctype in ([STATIC_REMOTEKEY], [STATIC_REMOTEKEY, ANCHORS_ZERO_FEE_HTLC_TX]):
26202622
ret = l1.rpc.openchannel_init(l3.info['id'], FUNDAMOUNT - 1000, psbt, channel_type=ctype)
26212623
assert ret['channel_type']['bits'] == ctype
2624+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype
2625+
assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype
26222626
l1.rpc.openchannel_abort(ret['channel_id'])
26232627

26242628
# Old anchors not supported for new channels
@@ -2652,13 +2656,17 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26522656

26532657
ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT, channel_type=[STATIC_REMOTEKEY, ANCHORS_OLD])
26542658
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD]
2659+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD]
2660+
# Note: l3 doesn't show it in listpeerchannels yet...
26552661
l1.rpc.fundchannel_cancel(l2.info['id'])
26562662

26572663
l1.rpc.unreserveinputs(psbt)
26582664

26592665
# Works with fundchannel / multifundchannel
26602666
ret = l1.rpc.fundchannel(l2.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY])
26612667
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY]
2668+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
2669+
assert only_one(l2.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
26622670
# FIXME: Check type is actually correct!
26632671

26642672
# Mine that so we can spend change.
@@ -2668,3 +2676,5 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26682676
l1.connect(l3)
26692677
ret = l1.rpc.fundchannel(l3.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY])
26702678
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY]
2679+
assert only_one(l1.rpc.listpeerchannels(l3.info['id'])['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
2680+
assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]

0 commit comments

Comments
 (0)