Skip to content

Commit 86e5b14

Browse files
committed
pytest: fix flake in test_rbf_reconnect_tx_construct
Once we speed things up, we can *receive* commitment_signed before we disconnect due to sending ours: in this case, we *will* have a scratch tx. Signed-off-by: Rusty Russell <[email protected]>
1 parent e20efa1 commit 86e5b14

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_opening.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams):
921921
# abort doesn't cause a disconnect
922922
assert l1.rpc.getpeer(l2.info['id'])['connected']
923923

924+
log_after_connect = l1.daemon.logsearch_start
925+
924926
# The next TX_COMPLETE break (both remember) + they break on the
925927
# COMMITMENT_SIGNED during the reconnect
926928
bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
@@ -945,12 +947,16 @@ def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams):
945947
l2.daemon.wait_for_logs([r'Got dualopend reestablish',
946948
r'No commitment, not sending our sigs',
947949
# This is a BROKEN log, it's expected!
948-
r'dualopend daemon died before signed PSBT returned|dualopend: Owning subdaemon dualopend died'])
950+
r'dualopend daemon died before signed PSBT returned|dualopend: Owning subdaemon dualopend died',
951+
r'Owning subdaemon dualopend died'])
949952

950-
# We don't have the commtiments yet, there's no scratch_txid
953+
# If we received their commitment_signed first, we *will* have scratch!
951954
inflights = only_one(l1.rpc.listpeerchannels()['channels'])['inflight']
952955
assert len(inflights) == 2
953-
assert 'scratch_txid' not in inflights[1]
956+
if l1.daemon.is_in_log('peer_in WIRE_COMMITMENT_SIGNED', start=log_after_connect):
957+
assert 'scratch_txid' in inflights[1]
958+
else:
959+
assert 'scratch_txid' not in inflights[1]
954960

955961
# After reconnecting, we have a scratch txid!
956962
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)

0 commit comments

Comments
 (0)