sweepbatcher: fix flacky TestPresigned/dust_main_output #1008
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.
The Problem
The test
TestPresigned/dust_main_output
was causing a deadlock. When the test calledbatcher.AddSweep
for the second time (with a valid sweep), the batcher would create a new batch and attempt to register for a spend notification. However, the test was not waiting for or consuming this notification registration, leading to a blocked goroutine and a timeout.The Fix
I have added a line to the test to consume the spend notification registration from the mock lnd's channel, similar to how other tests in the same file are structured. This prevents the deadlock.
The problem was introduced in commit 54652dc.
Example of a failure:
https://github.com/lightninglabs/loop/actions/runs/18077891523/job/51437024222?pr=1007
Pull Request Checklist
release_notes.md
if your PR contains major features, breaking changes or bugfixes