Skip to content

Commit cc3820e

Browse files
committed
fixup test races due to feature negotiation, change output cost
1 parent 1c203aa commit cc3820e

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

tests/test_bookkeeper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ def _check_events(node, channel_id, exp_events):
399399

400400
# l1 events
401401
exp_events = [('channel_open', open_amt * 1000 + lease_fee, 0),
402-
('onchain_fee', 1224000, 0),
402+
('onchain_fee', 1320000, 0),
403403
('lease_fee', 0, lease_fee),
404404
('journal_entry', 0, invoice_msat)]
405405
_check_events(l1, channel_id, exp_events)
406406

407407
exp_events = [('channel_open', open_amt * 1000, 0),
408-
('onchain_fee', 796000, 0),
408+
('onchain_fee', 892000, 0),
409409
('lease_fee', lease_fee, 0),
410410
('journal_entry', invoice_msat, 0)]
411411
_check_events(l2, channel_id, exp_events)

tests/test_closing.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
scriptpubkey_addr, calc_lease_fee,
99
check_utxos_channel, anchor_expected, check_coin_moves,
1010
check_balance_snaps, mine_funding_to_announce, check_inspect_channel,
11-
first_scid
11+
first_scid, expected_peer_features
1212
)
1313

1414
import os
@@ -1070,6 +1070,9 @@ def test_channel_lease_lessor_cheat(node_factory, bitcoind, chainparams):
10701070
# start l2 and force close channel with l1 while l1 is still offline
10711071
l2.start()
10721072
sync_blockheight(bitcoind, [l2])
1073+
# wait for reconnect, otherwise anysegwit feature bits won't be known
1074+
wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 1)
1075+
wait_for(lambda: l2.rpc.listpeers()['peers'][0].get('features', "") == expected_peer_features())
10731076
l2.rpc.close(l1.info['id'], 1, force_lease_closed=True)
10741077
bitcoind.generate_block(1, wait_for_mempool=1)
10751078

@@ -1147,6 +1150,9 @@ def test_channel_lease_lessee_cheat(node_factory, bitcoind, chainparams):
11471150
# start l1 and force close channel with l2 while l2 is still offline
11481151
l1.start()
11491152
sync_blockheight(bitcoind, [l1])
1153+
# wait for reconnect, otherwise anysegwit feature bits won't be known
1154+
wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 1)
1155+
wait_for(lambda: l1.rpc.listpeers()['peers'][0].get('features', "") == expected_peer_features())
11501156
l1.rpc.close(l2.info['id'], 1, force_lease_closed=True)
11511157
bitcoind.generate_block(1, wait_for_mempool=1)
11521158

tests/test_connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,10 @@ def test_reconnect_no_update(node_factory, executor, bitcoind):
792792

793793
# For closingd reconnection
794794
l1.daemon.start()
795+
# wait for reconnect, otherwise anysegwit feature bits won't be known
796+
wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 1)
797+
wait_for(lambda: l1.rpc.listpeers()['peers'][0].get('features', "") == expected_peer_features())
798+
795799
# Close will trigger the -WIRE_SHUTDOWN and we then wait for the
796800
# automatic reconnection to trigger the retransmission.
797801
l1.rpc.close(l2.info['id'], 0)

tests/test_opening.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from fixtures import TEST_NETWORK
33
from pyln.client import RpcError, Millisatoshi
44
from utils import (
5-
only_one, wait_for, sync_blockheight, first_channel_id, calc_lease_fee, check_coin_moves, anchor_expected
5+
only_one, wait_for, sync_blockheight, first_channel_id,
6+
calc_lease_fee, check_coin_moves, anchor_expected, expected_peer_features
67
)
78

89
from pathlib import Path
@@ -1630,6 +1631,8 @@ def test_v2_replay_bookkeeping(node_factory, bitcoind):
16301631
ev_tags = [e['tag'] for e in l1.rpc.bkpr_listaccountevents(chan_id)['events']]
16311632
assert 'lease_fee' in ev_tags
16321633

1634+
wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 1)
1635+
wait_for(lambda: l1.rpc.listpeers()['peers'][0].get('features', "") == expected_peer_features())
16331636
l1.rpc.close(l2.info['id'], 1)
16341637
bitcoind.generate_block(6, wait_for_mempool=1)
16351638

tests/test_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,9 @@ def test_coin_movement_notices(node_factory, bitcoind, chainparams):
20562056
chanid_1 = first_channel_id(l2, l1)
20572057
chanid_3 = first_channel_id(l2, l3)
20582058

2059+
# Wait until we have the expected features loaded before sending to taproot address
2060+
wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 2)
2061+
wait_for(lambda: [x.get("features", None) for x in l2.rpc.listpeers()['peers']] == [expected_peer_features()] * 2)
20592062
l2.rpc.close(chan1)
20602063
l2.daemon.wait_for_logs([
20612064
' to CLOSINGD_COMPLETE',

0 commit comments

Comments
 (0)