Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2558,6 +2558,10 @@ def test_onchain_middleman_fulfill_after_fail(node_factory, bitcoind):
partid=1, groupid=1)
l3.daemon.wait_for_log('holding htlc {}'.format(rhash))

# A block between the two gives them different deadlines.
bitcoind.generate_block(1)
sync_blockheight(bitcoind, [l1, l2, l3])

# And it fails this one.
l1.rpc.sendpay(l1.single_route(l3.info['id'], amt2), rhash,
amount_msat=amt1 + amt2,
Expand All @@ -2578,9 +2582,12 @@ def test_onchain_middleman_fulfill_after_fail(node_factory, bitcoind):

# Now l3 learns the preimage, and spends what it's owed.
l3.rpc.releasehtlc(preimage)
_, txid, _ = l3.wait_for_onchaind_tx('OUR_HTLC_SUCCESS_TX',
'OUR_UNILATERAL/THEIR_HTLC')
bitcoind.generate_block(1, wait_for_mempool=[txid])
l3.wait_for_onchaind_tx('OUR_HTLC_SUCCESS_TX',
'OUR_UNILATERAL/THEIR_HTLC')
# Both HTLC claims spend l3's only wallet UTXO, and their deadlines
# differ, so only the higher-feerate one stays in the mempool. Either
# reveals the preimage.
bitcoind.generate_block(1, wait_for_mempool=1)
l2.daemon.wait_for_log('THEIR_UNILATERAL/OUR_HTLC gave us preimage')

# Both payments must succeed, including the one l3 said it failed.
Expand Down
Loading