Skip to content

Commit 8cbb245

Browse files
committed
pytest: fix flake in splice gossip test.
We can in fact see the new channel before this line is called: ``` 2025-03-15T12:31:04.1472196Z @pytest.mark.openchannel('v1') 2025-03-15T12:31:04.1472616Z @pytest.mark.openchannel('v2') 2025-03-15T12:31:04.1473317Z @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') 2025-03-15T12:31:04.1474271Z def test_splice_gossip(node_factory, bitcoind): 2025-03-15T12:31:04.1475078Z l1, l2, l3 = node_factory.line_graph(3, fundamount=1000000, wait_for_announce=True, opts={'experimental-splicing': None}) 2025-03-15T12:31:04.1475781Z 2025-03-15T12:31:04.1476052Z chan_id = l1.get_channel_id(l2) 2025-03-15T12:31:04.1476460Z pre_splice_scid = first_scid(l1, l2) 2025-03-15T12:31:04.1476844Z 2025-03-15T12:31:04.1477134Z # add extra sats to pay fee 2025-03-15T12:31:04.1477741Z funds_result = l1.rpc.fundpsbt("109000sat", "slow", 166, excess_as_change=True) 2025-03-15T12:31:04.1478345Z 2025-03-15T12:31:04.1478765Z result = l1.rpc.splice_init(chan_id, 100000, funds_result['psbt']) 2025-03-15T12:31:04.1479432Z result = l1.rpc.splice_update(chan_id, result['psbt']) 2025-03-15T12:31:04.1479994Z assert(result['commitments_secured'] is False) 2025-03-15T12:31:04.1480584Z result = l1.rpc.splice_update(chan_id, result['psbt']) 2025-03-15T12:31:04.1481089Z assert(result['commitments_secured'] is True) 2025-03-15T12:31:04.1481386Z result = l1.rpc.signpsbt(result['psbt']) 2025-03-15T12:31:04.1481860Z result = l1.rpc.splice_signed(chan_id, result['signed_psbt']) 2025-03-15T12:31:04.1482403Z 2025-03-15T12:31:04.1485960Z wait_for(lambda: only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])['state'] == 'CHANNELD_AWAITING_SPLICE') 2025-03-15T12:31:04.1489978Z wait_for(lambda: only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['state'] == 'CHANNELD_AWAITING_SPLICE') 2025-03-15T12:31:04.1490796Z 2025-03-15T12:31:04.1491223Z bitcoind.generate_block(6, wait_for_mempool=result['txid']) 2025-03-15T12:31:04.1491767Z 2025-03-15T12:31:04.1492213Z # l3 will see channel dying, but still consider it OK for 12 blocks. 2025-03-15T12:31:04.1493174Z l3.daemon.wait_for_log(f'gossipd: channel {pre_splice_scid} closing soon due to the funding outpoint being spent') 2025-03-15T12:31:04.1494422Z assert len(l3.rpc.listchannels(short_channel_id=pre_splice_scid)['channels']) == 2 2025-03-15T12:31:04.1495293Z > assert len(l3.rpc.listchannels(source=l1.info['id'])['channels']) == 1 2025-03-15T12:31:04.1495937Z E AssertionError: assert 2 == 1 2025-03-15T12:31:04.1503185Z E + where 2 = len([{'active': True, 'amount_msat': 1000000000, 'base_fee_millisatoshi': 1, 'channel_flags': 1, ...}, {'active': True, 'amount_msat': 1100000000, 'base_fee_millisatoshi': 1, 'channel_flags': 1, ...}]) ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 5ba5546 commit 8cbb245

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_splicing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ def test_splice_gossip(node_factory, bitcoind):
9696
wait_for(lambda: only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])['state'] == 'CHANNELD_AWAITING_SPLICE')
9797
wait_for(lambda: only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['state'] == 'CHANNELD_AWAITING_SPLICE')
9898

99-
bitcoind.generate_block(6, wait_for_mempool=result['txid'])
99+
bitcoind.generate_block(5, wait_for_mempool=result['txid'])
100100

101101
# l3 will see channel dying, but still consider it OK for 12 blocks.
102102
l3.daemon.wait_for_log(f'gossipd: channel {pre_splice_scid} closing soon due to the funding outpoint being spent')
103103
assert len(l3.rpc.listchannels(short_channel_id=pre_splice_scid)['channels']) == 2
104104
assert len(l3.rpc.listchannels(source=l1.info['id'])['channels']) == 1
105105

106+
# Final one will allow splice announcement to proceed.
107+
bitcoind.generate_block(1)
106108
wait_for(lambda: only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])['state'] == 'CHANNELD_NORMAL')
107109
wait_for(lambda: only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['state'] == 'CHANNELD_NORMAL')
108110

0 commit comments

Comments
 (0)