sweepbatcher: add an option to ignore HTLC txids

Added option WithSkippedTxns, which has one historical problematic tx by default.
Sweeps originating from these transactions are omitted when reading from DB.

loopdb: add column sweep_batches.cancelled and replaced DropBatch with
CancelBatch. It is needed, because sweep.batch_id is a foreign key to batch.

Changed StoreMock.InsertSweepBatch not to reuse batch_id. This is needed by
the test, which checks that new batch has fresh ID.
This commit is contained in:
Boris Nagaev 2025-06-17 14:01:59 -03:00
parent 1ab73a6272
commit 1036214160
No known key found for this signature in database
16 changed files with 349 additions and 58 deletions

View file

@ -4,7 +4,7 @@ SELECT
FROM
sweep_batches
WHERE
confirmed = FALSE;
confirmed = FALSE AND cancelled = FALSE;
-- name: InsertBatch :one
INSERT INTO sweep_batches (
@ -23,8 +23,10 @@ INSERT INTO sweep_batches (
$6
) RETURNING id;
-- name: DropBatch :exec
DELETE FROM sweep_batches WHERE id = $1;
-- name: CancelBatch :exec
UPDATE sweep_batches SET
cancelled = TRUE
WHERE id = $1;
-- name: UpdateBatch :exec
UPDATE sweep_batches SET