Skip to content

Conversation

starius
Copy link
Collaborator

@starius starius commented Oct 3, 2025

Re-ordered the cleanup in handleSweeps so completed batches are deleted only after any re-add attempt, preventing a finished batch from being dropped before it can absorb the re-add.

Added a fresh status/parent-batch lookup inside handleSweeps so the logic now reacts to swaps that complete between AddSweep and the event-loop handler; fully confirmed sweeps are routed straight to monitorSpendAndNotify instead of spawning a duplicate batch.

Added regression test testSweepBatcherHandleSweepRace, which replays the AddSweep/confirmation race and verifies that only the original batch remains and the sweep keeps its parent assignment.

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

Re-ordered the cleanup in handleSweeps so completed batches are deleted only
after any re-add attempt, preventing a finished batch from being dropped before
it can absorb the re-add.

Added a fresh status/parent-batch lookup inside handleSweeps so the logic now
reacts to swaps that complete between AddSweep and the event-loop handler; fully
confirmed sweeps are routed straight to monitorSpendAndNotify instead of
spawning a duplicate batch.

Added regression test testSweepBatcherHandleSweepRace, which replays the
AddSweep/confirmation race and verifies that only the original batch remains and
the sweep keeps its parent assignment.
@starius starius force-pushed the sweepbatcher-close-add-race branch from 7de89c3 to d90b4c2 Compare October 3, 2025 05:29
@starius starius marked this pull request as ready for review October 3, 2025 05:53
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@starius starius merged commit d346cb3 into lightninglabs:master Oct 6, 2025
4 checks passed
@starius starius deleted the sweepbatcher-close-add-race branch October 6, 2025 14:31
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.

3 participants