Skip to content

tests: fix flaky test_bwatch_listwatch - #9361

Open
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-listwatch-baseline-race
Open

tests: fix flaky test_bwatch_listwatch#9361
ksedgwic wants to merge 1 commit into
ElementsProject:masterfrom
ksedgwic:fix-listwatch-baseline-race

Conversation

@ksedgwic

Copy link
Copy Markdown
Collaborator

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

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
@ksedgwic
ksedgwic requested a review from sangbida July 28, 2026 17:26

@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.

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
daywalker90 enabled auto-merge (rebase) July 29, 2026 10:12
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_bwatch_listwatch count assertions race the wallet's startup watch registration

2 participants