tests: fix flaky test_bwatch_listwatch - #9361
Open
ksedgwic wants to merge 1 commit into
Open
Conversation
The wallet registers its own scriptpubkey watches at node startup since the bwatch series landed. The test anticipates them by recording a total-count baseline first, but on a slow machine the registration can land after the baseline is taken: an ASan CI run caught a baseline of 0 and a final count of 105. A total-count assertion races background registration no matter when the baseline is read. Count only the watches this test adds (their identifiers are distinctive), which no background registration can perturb. The test's per-watch assertions already work that way. Fixes: ElementsProject#9360 Changelog-None
Andezion
approved these changes
Jul 28, 2026
Andezion
left a comment
Collaborator
There was a problem hiding this comment.
The fix correctly addresses the described race by making the assertions independent of wallet startup timing, and the per-watch checks are left alone. Look good to me!
daywalker90
enabled auto-merge (rebase)
July 29, 2026 10:12
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 #9360 : the test's total-count assertions race the wallet's
startup scriptpubkey watch registration, which on slow runners can
land at any point during the test. Count only the watches the test
adds itself -- their identifiers are distinctive, and no background
registration can perturb that set. The per-watch assertions already
work that way.
Changelog-None