tests: fix flaky test_onchain_rbf_stops_after_confirmation#9348
Open
ksedgwic wants to merge 1 commit into
Open
tests: fix flaky test_onchain_rbf_stops_after_confirmation#9348ksedgwic wants to merge 1 commit into
ksedgwic wants to merge 1 commit into
Conversation
The test censors l2's sendrawtransaction with an rpcproxy mock while the node RBFs its penalty tx three times, then removes the mock so the next RBF version reaches bitcoind for real and gets mined. But each 'RBF onchain txid' log line precedes the corresponding broadcast, so wait_for_log can return -- and the test un-mock -- while the third replacement is still in flight. That older version then lands in bitcoind's real mempool, the next version's broadcast is rejected as a conflict, and the block mines a version the node no longer tracks, so RBF-ing continues after confirmation and the final assertion fails. Seen under valgrind, where the window between log line and broadcast is wide. Count the broadcasts the censoring mock swallows and wait for all four (initial penalty tx plus three replacements) to have reached the proxy before un-mocking, so no broadcast can be in flight when censoring stops. Fixes: ElementsProject#9347 Changelog-None
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9347.
The test censors l2's sendrawtransaction with an rpcproxy mock while the node RBFs its penalty tx three times, then removes the mock so the next RBF version reaches bitcoind for real and gets mined. But each 'RBF onchain txid' log line precedes the corresponding broadcast, so wait_for_log can return -- and the test un-mock -- while the third replacement is still in flight. That older version then lands in bitcoind's real mempool, the next version's broadcast is rejected as a conflict, and the block mines a version the node no longer tracks, so RBF-ing continues after confirmation and the final assertion fails. The full log timeline is in #9347; seen under valgrind, where the window between log line and broadcast is wide.
The fix counts the broadcasts the censoring mock swallows and waits for all four (initial penalty tx plus three replacements) to have reached the proxy before un-mocking, so no broadcast can be in flight when censoring stops.
Verified with three consecutive local runs under valgrind.