loop/sweepbatcher
Boris Nagaev 8a4e2f1941
sweepbatcher: normalize run-loop shutdown errors
AddSweep now masks cancellation races during its caller-side setup, but
a request can still be accepted by the batcher run loop before the run
context cancellation is selected. If handleSweeps then performs a
context-sensitive store call while shutdown is in progress, a
backend-specific error such as driver.ErrBadConn can still bubble out
through Batcher.Run.

Prefer the run context's terminal error when startup, handleSweeps, or
asynchronous errChan failures happen after the run context has been
canceled. This keeps normal shutdown reporting consistent and avoids
surfacing backend driver errors from the accepted-request and async
error paths.

Log the original run-loop error before returning the context error so
normal shutdown remains debuggable without changing the returned error.

Add regression tests for both covered run-loop races. One lets AddSweep
successfully hand a sweep request to Run, then cancels the run context
from the second GetSweepStatus call while returning driver.ErrBadConn.
The other queues an errChan error from the event loop while canceling
the run context. Both tests assert that Run returns context.Canceled and
does not wrap the driver error.
2026-05-18 11:58:54 +02:00
..
greedy_batch_selection.go lint: fix linter issues 2026-03-09 14:39:45 +01:00
greedy_batch_selection_test.go sweepbatcher: consolidate identical change pkscripts 2025-07-29 21:22:17 +02:00
log.go lint: fix linter issues 2026-03-09 14:39:45 +01: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 sweepbatcher: persist confirmed batches atomically 2025-12-04 00:37:01 -03:00
store_mock.go sweepbatcher: persist confirmed batches atomically 2025-12-04 00:37:01 -03:00
sweep_batch.go lint: fix linter issues 2026-03-09 14:39:45 +01:00
sweep_batch_test.go sweepbatcher: consolidate identical change pkscripts 2025-07-29 21:22:17 +02:00
sweep_batcher.go sweepbatcher: normalize run-loop shutdown errors 2026-05-18 11:58:54 +02: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: normalize run-loop shutdown errors 2026-05-18 11:58:54 +02:00