Skip to content

tests: fix flaky test_simple_close_dust_output_omitted mempool race#9299

Open
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-simple-close-dust-race
Open

tests: fix flaky test_simple_close_dust_output_omitted mempool race#9299
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-flaky-simple-close-dust-race

Conversation

@ksedgwic

@ksedgwic ksedgwic commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Observed on a CI run for #9286 (postgres full integration, 1 failed / 1012 passed):
https://github.com/ElementsProject/lightning/actions/runs/28971841260

The test snapshots getrawmempool() and then fetches each txid with
getrawtransaction(). Both peers broadcast conflicting closer txs; in
the dust scenario l2's tx pays only 400sat fee (its whole balance)
while l1's pays 3375sat, so l1's tx RBF-replaces l2's. When the
replacement lands between the snapshot and the fetch,
getrawtransaction() fails with error -5 (No such mempool or blockchain
transaction). The captured node logs show l2's tx replaced 14ms after
broadcast.

The fix retries the snapshot-and-check loop when a txid vanishes
mid-iteration; the single-output assertion still fails hard. Same
class of race as the test_simple_close_delay_broadcast fix in
5ae0705.

Changelog-None

The test snapshots getrawmempool() and then calls getrawtransaction()
on each txid.  In simple close both peers broadcast conflicting closer
txs: here l2's tx pays only 400sat fee (its entire 400sat balance goes
to fees since its own output is dust) while l1's pays 3375sat, so l1's
tx can RBF-replace l2's between the snapshot and the fetch.  The
getrawtransaction() call on the replaced txid then fails with error -5
(No such mempool or blockchain transaction).  A CI failure showed
exactly this ordering: l2 broadcast its closer tx, l1's higher-fee tx
replaced it 14ms later, and the test's per-txid fetch raced the
replacement.

Retry the whole snapshot-and-check loop when a txid vanishes
mid-iteration, keeping the single-output assertion hard.  This is the
same class of mempool race fixed for test_simple_close_delay_broadcast
in 5ae0705 ("tests: fix flaky test_simple_close_delay_broadcast
mempool race").

Changelog-None
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.

1 participant