Skip to content

tests: wait for either OUR_HTLC_SUCCESS_TX in test_onchain_middleman_fulfill_after_fail - #9567

Open
daywalker90 wants to merge 1 commit into
ElementsProject:masterfrom
daywalker90:fix-test_onchain_middleman_fulfill_after_fail
Open

daywalker90 wants to merge 1 commit into
ElementsProject:masterfrom
daywalker90:fix-test_onchain_middleman_fulfill_after_fail

Conversation

@daywalker90

@daywalker90 daywalker90 commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog-None

Fixes: #9549

@daywalker90
daywalker90 marked this pull request as draft September 24, 2026 18:34
@daywalker90
daywalker90 removed the request for review from Andezion September 24, 2026 18:34
@daywalker90
daywalker90 force-pushed the fix-test_onchain_middleman_fulfill_after_fail branch from b8f860a to 5f37da1 Compare September 28, 2026 12:32
@daywalker90 daywalker90 changed the title lightningd: reserve HTLC boost UTXOs; test waits for either success txid tests: wait for either OUR_HTLC_SUCCESS_TX in test_onchain_middleman_fulfill_after_fail Sep 28, 2026
@daywalker90
daywalker90 marked this pull request as ready for review September 28, 2026 17:05
Andezion
Andezion previously approved these changes Sep 30, 2026

@Andezion Andezion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider bitcoind.generate_block(1, wait_for_mempool=1) after waiting for the two broadcasts? l3 can only ever have one of the two txs in the mempool, and nothing else should be there at this point, so maaaaaaybe it would be a little shorter

Comment thread tests/test_closing.py
# so only one can enter the mempool at a time. Wait for either.
needle = l3.daemon.logsearch_start
l3.rpc.releasehtlc(preimage)
_, txid, _ = l3.wait_for_onchaind_tx('OUR_HTLC_SUCCESS_TX',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wait on the type-specific onchaind line instead, such as ['Telling lightningd about OUR_HTLC_SUCCESS_TX to resolve OUR_UNILATERAL/THEIR_HTLC'] * 2. That is the same line wait_for_onchaind_txs uses. Then collect the broadcast txids?

Comment thread tests/test_closing.py Outdated
if m:
txids.append(bitcoind.rpc.decoderawtransaction(m.group(1))['txid'])
assert len(txids) >= 2
wait_for(lambda: any(t in bitcoind.rpc.getrawmempool() for t in txids[-2:]))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait_for(lambda: any(t in bitcoind.rpc.getrawmempool() for t in txids))? wait_for_logs already ensures there are at least two matches, so the assert never fails, no?

@daywalker90
daywalker90 force-pushed the fix-test_onchain_middleman_fulfill_after_fail branch from 5f37da1 to 1394cb1 Compare September 30, 2026 08:51
@daywalker90

Copy link
Copy Markdown
Collaborator Author

Good idea, how about this approach?

@daywalker90
daywalker90 requested a review from Andezion October 1, 2026 14:58
…fulfill_after_fail

The two success txs share a wallet UTXO for fee boost, so only one can
be in the mempool at a time.  Waiting for the first broadcast's txid
could latch onto the loser and time out; wait for either instead.

Changelog-None
@daywalker90
daywalker90 force-pushed the fix-test_onchain_middleman_fulfill_after_fail branch from 1394cb1 to 26e67fa Compare October 13, 2026 14:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI flake test_onchain_middleman_fulfill_after_fail

2 participants