paymentsdb: remove dead inflight helper code
What changed, and why it matters
This commit simply deletes unused helper code from the payment database layer. No security issue is present; it is a routine cleanup that removes dead code reported by the linter after a previous API removal.
No action needed. This is a benign dead-code removal.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change removes the now-unused paymentsCompleteData, batchLoadPayments, paymentsBaseData, and batchLoadpaymentsBaseData types/functions from payments/db/sql_store.go. These helpers were only used by the removed FetchAllInflightAttempts query API. The commit is purely a code-health refactor with no functional or security changes.
Changed components
payments/db/sql_store.goInspect captured patch +0 / −82
diff --git a/payments/db/sql_store.go b/payments/db/sql_store.go
index ed12a57..6454ab4 100644
--- a/payments/db/sql_store.go
+++ b/payments/db/sql_store.go
@@ -181,88 +181,6 @@ func fetchPaymentWithCompleteData(ctx context.Context,
return buildPaymentFromBatchData(dbPayment, batchData, true)
}
-// paymentsCompleteData holds the full payment data when batch loading base
-// payment data and all the related data for a payment.
-type paymentsCompleteData struct {
- *paymentsBaseData
- *paymentsDetailsData
-}
-
-// batchLoadPayments loads the full payment data for a batch of payment IDs.
-func batchLoadPayments(ctx context.Context, cfg *sqldb.QueryConfig,
- db SQLQueries, paymentIDs []int64) (*paymentsCompleteData, error) {
-
- baseData, err := batchLoadpaymentsBaseData(ctx, cfg, db, paymentIDs)
- if err != nil {
- return nil, fmt.Errorf("failed to load payment base data: %w",
- err)
- }
-
- batchData, err := batchLoadPaymentDetailsData(
- ctx, cfg, db, paymentIDs, true,
- )
- if err != nil {
- return nil, fmt.Errorf("failed to load payment batch data: %w",
- err)
- }
-
- return &paymentsCompleteData{
- paymentsBaseData: baseData,
- paymentsDetailsData: batchData,
- }, nil
-}
-
-// paymentsBaseData holds the base payment and intent data for a batch of
-// payments.
-type paymentsBaseData struct {
- // paymentsAndIntents maps payment ID to its payment and intent data.
- paymentsAndIntents map[int64]sqlc.PaymentAndIntent
-}
-
-// batchLoadpaymentsBaseData loads the base payment and payment intent data for
-// a batch of payment IDs. This complements loadPaymentsBatchData which loads
-// related data (attempts, hops, custom records) but not the payment table
-// and payment intent table data.
-func batchLoadpaymentsBaseData(ctx context.Context,
- cfg *sqldb.QueryConfig, db SQLQueries,
- paymentIDs []int64) (*paymentsBaseData, error) {
-
- baseData := &paymentsBaseData{
- paymentsAndIntents: make(map[int64]sqlc.PaymentAndIntent),
- }
-
- if len(paymentIDs) == 0 {
- return baseData, nil
- }
-
- err := sqldb.ExecuteBatchQuery(
- ctx, cfg, paymentIDs,
- func(id int64) int64 { return id },
- func(ctx context.Context, ids []int64) (
- []sqlc.FetchPaymentsByIDsRow, error) {
-
- records, err := db.FetchPaymentsByIDs(
- ctx, ids,
- )
-
- return records, err
- },
- func(ctx context.Context,
- payment sqlc.FetchPaymentsByIDsRow) error {
-
- baseData.paymentsAndIntents[payment.ID] = payment
-
- return nil
- },
- )
- if err != nil {
- return nil, fmt.Errorf("failed to fetch payment base "+
- "data: %w", err)
- }
-
- return baseData, nil
-}
-
// paymentsRelatedData holds all the batch-loaded data for multiple payments.
// This does not include the base payment and intent data which is fetched
// separately. It includes the additional data like attempts, hops, hop custom
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.