loop/sweepbatcher
Boris Nagaev 37eb3462e5
sweepbatcher: handle batch shutdown during re-add
Started from CI failure of TestSweepBatcherHandleSweepRace/loopdb [1] that
surfaced ErrBatcherShuttingDown when the AddSweep loop caught a batch right as
it finished. Reproduced via:

go test ./sweepbatcher -run TestSweepBatcherHandleSweepRace/loopdb -cpu=12,4,8 -count=1

Discovered that handleSweeps treated ErrBatchShuttingDown from batch.addSweeps
as fatal, so the batcher exited even though the sweep was already confirmed.
Fixed by treating that error as "batch already done" so we fall through to the
persisted status/monitorSpend path, and added a regression test that
deterministically simulates the shutdown window.

New regression test added:
go test ./sweepbatcher -run TestSweepBatcherHandleBatchShutdown

[1] https://github.com/lightninglabs/loop/actions/runs/19282552307/job/55136597881?pr=1041
2025-11-12 01:45:18 -03:00
..
greedy_batch_selection.go sweepbatcher: fast-flag enables zero delay publishing 2025-10-07 08:53:39 +02:00
greedy_batch_selection_test.go sweepbatcher: consolidate identical change pkscripts 2025-07-29 21:22:17 +02:00
log.go sweepbatcher: add mode with presigned transactions 2025-05-08 17:24:10 -03:00
presigned.go sweepbatcher: presign transactions in parallel 2025-10-14 22:37:18 -03:00
presigned_test.go sweepbatcher: presign transactions in parallel 2025-10-14 22:37:18 -03:00
store.go loopdb: remove unused method ConfirmBatch 2025-06-26 14:01:16 -03:00
store_mock.go loopdb: remove unused method ConfirmBatch 2025-06-26 14:01:16 -03:00
sweep_batch.go sweepbatcher: fix code format 2025-11-12 01:45:18 -03:00
sweep_batch_test.go sweepbatcher: consolidate identical change pkscripts 2025-07-29 21:22:17 +02:00
sweep_batcher.go sweepbatcher: handle batch shutdown during re-add 2025-11-12 01:45:18 -03:00
sweep_batcher_presigned_test.go sweepbatcher: fix fee rate calculation (publish) 2025-10-11 22:15:56 -03:00
sweep_batcher_test.go sweepbatcher: handle batch shutdown during re-add 2025-11-12 01:45:18 -03:00