Skip to content

Commit 86f4ee1

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 <[email protected]>
1 parent b85227e commit 86f4ee1

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
@@ -2614,6 +2614,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26142614
ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT,
26152615
channel_type=ctype + zeroconf)
26162616
assert ret['channel_type']['bits'] == ctype + zeroconf
2617+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype + zeroconf
2618+
# Note: l2 doesn't show it in listpeerchannels yet...
26172619
l1.rpc.fundchannel_cancel(l2.info['id'])
26182620

26192621
# Zeroconf is refused to l4.
@@ -2627,6 +2629,8 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26272629
for ctype in ([STATIC_REMOTEKEY], [STATIC_REMOTEKEY, ANCHORS_ZERO_FEE_HTLC_TX]):
26282630
ret = l1.rpc.openchannel_init(l3.info['id'], FUNDAMOUNT - 1000, psbt, channel_type=ctype)
26292631
assert ret['channel_type']['bits'] == ctype
2632+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype
2633+
assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == ctype
26302634
l1.rpc.openchannel_abort(ret['channel_id'])
26312635

26322636
# Old anchors not supported for new channels
@@ -2660,13 +2664,17 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26602664

26612665
ret = l1.rpc.fundchannel_start(l2.info['id'], FUNDAMOUNT, channel_type=[STATIC_REMOTEKEY, ANCHORS_OLD])
26622666
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD]
2667+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY, ANCHORS_OLD]
2668+
# Note: l3 doesn't show it in listpeerchannels yet...
26632669
l1.rpc.fundchannel_cancel(l2.info['id'])
26642670

26652671
l1.rpc.unreserveinputs(psbt)
26662672

26672673
# Works with fundchannel / multifundchannel
26682674
ret = l1.rpc.fundchannel(l2.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY])
26692675
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY]
2676+
assert only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
2677+
assert only_one(l2.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
26702678
# FIXME: Check type is actually correct!
26712679

26722680
# Mine that so we can spend change.
@@ -2676,3 +2684,5 @@ def test_opening_explicit_channel_type(node_factory, bitcoind):
26762684
l1.connect(l3)
26772685
ret = l1.rpc.fundchannel(l3.info['id'], FUNDAMOUNT // 3, channel_type=[STATIC_REMOTEKEY])
26782686
assert ret['channel_type']['bits'] == [STATIC_REMOTEKEY]
2687+
assert only_one(l1.rpc.listpeerchannels(l3.info['id'])['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]
2688+
assert only_one(l3.rpc.listpeerchannels()['channels'])['channel_type']['bits'] == [STATIC_REMOTEKEY]

0 commit comments

Comments
 (0)