Skip to content

Commit a7bcbfe

Browse files
committed
pytest: fix flake when htlc_timeout_tx gets short sig:
``` check_channel_moves(l1, expected_channel1) > check_chain_moves(l1, expected_chain1) tests/test_coinmoves.py:942: ... 'account_id': 'wallet', 'blockheight': 115, 'created_index': 15, - 'credit_msat': Decimal('6358000.00000000'), - 'debit_msat': 0, ? -- + 'credit_msat': 6366000, ? +++ ++++++ + 'debit_msat': 0, 'extra_tags': [], - 'output_msat': Decimal('6358000.00000000'), + 'output_msat': 6366000, 'primary_tag': 'deposit', 'utxo': '4a16b7aceac233ed68bed0f18adfc1ab338b5fc55b696d1376eea173adeac8e3:1', }, ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 5397b35 commit a7bcbfe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_coinmoves.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,8 @@ def test_coinmoves_unilateral_htlc_timeout(node_factory, bitcoind):
894894

895895
line = l1.daemon.wait_for_log('Resolved OUR_UNILATERAL/OUR_HTLC by our proposal OUR_HTLC_TIMEOUT_TX')
896896
htlc_timeout_txid = re.search(r'by our proposal OUR_HTLC_TIMEOUT_TX \(([0-9a-f]{64})\)', line).group(1)
897+
# Usually 6358000, but if we're lucky it's 6366000.
898+
htlc_timeout_change_msats = bitcoind.rpc.gettxout(htlc_timeout_txid, 1)['value'] * 100_000_000_000
897899
expected_chain1 += [{'account_id': 'wallet',
898900
'blockheight': 115,
899901
'credit_msat': 0,
@@ -906,10 +908,10 @@ def test_coinmoves_unilateral_htlc_timeout(node_factory, bitcoind):
906908
# Change
907909
{'account_id': 'wallet',
908910
'blockheight': 115,
909-
'credit_msat': (15579000 + 6358000) - anchor_change_msats,
911+
'credit_msat': htlc_timeout_change_msats,
910912
'debit_msat': 0,
911913
'extra_tags': [],
912-
'output_msat': (15579000 + 6358000) - anchor_change_msats,
914+
'output_msat': htlc_timeout_change_msats,
913915
'primary_tag': 'deposit',
914916
'utxo': f"{htlc_timeout_txid}:1"},
915917
{'account_id': fundchannel['channel_id'],

0 commit comments

Comments
 (0)