From 1794aa21e5d08f562eaeeb5ec4e85571dc7280e9 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 12 Jun 2025 13:29:48 -0300 Subject: [PATCH] loopdb: remove unused method ConfirmBatch --- loopdb/sqlc/batch.sql.go | 14 -------------- loopdb/sqlc/querier.go | 1 - loopdb/sqlc/queries/batch.sql | 8 -------- sweepbatcher/store.go | 8 -------- sweepbatcher/store_mock.go | 16 ---------------- sweepbatcher/sweep_batcher.go | 3 --- 6 files changed, 50 deletions(-) diff --git a/loopdb/sqlc/batch.sql.go b/loopdb/sqlc/batch.sql.go index 875473fe..ce127f90 100644 --- a/loopdb/sqlc/batch.sql.go +++ b/loopdb/sqlc/batch.sql.go @@ -21,20 +21,6 @@ func (q *Queries) CancelBatch(ctx context.Context, id int32) error { return err } -const confirmBatch = `-- name: ConfirmBatch :exec -UPDATE - sweep_batches -SET - confirmed = TRUE -WHERE - id = $1 -` - -func (q *Queries) ConfirmBatch(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, confirmBatch, id) - return err -} - const getBatchSweeps = `-- name: GetBatchSweeps :many SELECT id, swap_hash, batch_id, outpoint, amt, completed diff --git a/loopdb/sqlc/querier.go b/loopdb/sqlc/querier.go index c293deb9..15b2e388 100644 --- a/loopdb/sqlc/querier.go +++ b/loopdb/sqlc/querier.go @@ -13,7 +13,6 @@ type Querier interface { AllDeposits(ctx context.Context) ([]Deposit, error) AllStaticAddresses(ctx context.Context) ([]StaticAddress, error) CancelBatch(ctx context.Context, id int32) error - ConfirmBatch(ctx context.Context, id int32) error CreateDeposit(ctx context.Context, arg CreateDepositParams) error CreateReservation(ctx context.Context, arg CreateReservationParams) error CreateStaticAddress(ctx context.Context, arg CreateStaticAddressParams) error diff --git a/loopdb/sqlc/queries/batch.sql b/loopdb/sqlc/queries/batch.sql index 2a869607..e1d42be4 100644 --- a/loopdb/sqlc/queries/batch.sql +++ b/loopdb/sqlc/queries/batch.sql @@ -37,14 +37,6 @@ UPDATE sweep_batches SET last_rbf_sat_per_kw = $6 WHERE id = $1; --- name: ConfirmBatch :exec -UPDATE - sweep_batches -SET - confirmed = TRUE -WHERE - id = $1; - -- name: UpsertSweep :exec INSERT INTO sweeps ( swap_hash, diff --git a/sweepbatcher/store.go b/sweepbatcher/store.go index 861882d2..3af26bf0 100644 --- a/sweepbatcher/store.go +++ b/sweepbatcher/store.go @@ -16,9 +16,6 @@ import ( // Querier is the interface that contains all the queries generated // by sqlc for sweep batcher. type Querier interface { - // ConfirmBatch confirms a batch by setting the state to confirmed. - ConfirmBatch(ctx context.Context, id int32) error - // GetBatchSweeps fetches all the sweeps that are part a batch. GetBatchSweeps(ctx context.Context, batchID int32) ( []sqlc.Sweep, error) @@ -124,11 +121,6 @@ func (s *SQLStore) UpdateSweepBatch(ctx context.Context, batch *dbBatch) error { return s.baseDb.UpdateBatch(ctx, batchToUpdateArgs(*batch)) } -// ConfirmBatch confirms a batch by setting the state to confirmed. -func (s *SQLStore) ConfirmBatch(ctx context.Context, id int32) error { - return s.baseDb.ConfirmBatch(ctx, id) -} - // FetchBatchSweeps fetches all the sweeps that are part a batch. func (s *SQLStore) FetchBatchSweeps(ctx context.Context, id int32) ( []*dbSweep, error) { diff --git a/sweepbatcher/store_mock.go b/sweepbatcher/store_mock.go index 23e15f9e..2e28a603 100644 --- a/sweepbatcher/store_mock.go +++ b/sweepbatcher/store_mock.go @@ -77,22 +77,6 @@ func (s *StoreMock) UpdateSweepBatch(ctx context.Context, return nil } -// ConfirmBatch confirms a batch. -func (s *StoreMock) ConfirmBatch(ctx context.Context, id int32) error { - s.mu.Lock() - defer s.mu.Unlock() - - batch, ok := s.batches[id] - if !ok { - return errors.New("batch not found") - } - - batch.Confirmed = true - s.batches[batch.ID] = batch - - return nil -} - // FetchBatchSweeps fetches all the sweeps that belong to a batch. func (s *StoreMock) FetchBatchSweeps(ctx context.Context, id int32) ([]*dbSweep, error) { diff --git a/sweepbatcher/sweep_batcher.go b/sweepbatcher/sweep_batcher.go index 7fbbcda4..6bab035e 100644 --- a/sweepbatcher/sweep_batcher.go +++ b/sweepbatcher/sweep_batcher.go @@ -59,9 +59,6 @@ type BatcherStore interface { // UpdateSweepBatch updates a batch in the database. UpdateSweepBatch(ctx context.Context, batch *dbBatch) error - // ConfirmBatch confirms a batch by setting its state to confirmed. - ConfirmBatch(ctx context.Context, id int32) error - // FetchBatchSweeps fetches all the sweeps that belong to a batch. FetchBatchSweeps(ctx context.Context, id int32) ([]*dbSweep, error)