multi: implement Fail method for sql backend

This commit is contained in:
ziggie committed 2026-02-25 08:02:15 +01:00
1 parent caf73c59da
commit fd6796e561
4 files changed
+83

No files matched your search

+13
View File
@@ -85,6 +85,19 @@ func (q *Queries) FailAttempt(ctx context.Context, arg FailAttemptParams) error
return err
}
const failPayment = `-- name: FailPayment :execresult
UPDATE payments SET fail_reason = $1 WHERE payment_identifier = $2
`
type FailPaymentParams struct {
FailReason sql.NullInt32
PaymentIdentifier []byte
}
func (q *Queries) FailPayment(ctx context.Context, arg FailPaymentParams) (sql.Result, error) {
return q.db.ExecContext(ctx, failPayment, arg.FailReason, arg.PaymentIdentifier)
}
const fetchAllInflightAttempts = `-- name: FetchAllInflightAttempts :many
SELECT
ha.id,
+1
View File
@@ -35,6 +35,7 @@ type Querier interface {
DeleteUnconnectedNodes(ctx context.Context) ([][]byte, error)
DeleteZombieChannel(ctx context.Context, arg DeleteZombieChannelParams) (sql.Result, error)
FailAttempt(ctx context.Context, arg FailAttemptParams) error
FailPayment(ctx context.Context, arg FailPaymentParams) (sql.Result, error)
FetchAMPSubInvoiceHTLCs(ctx context.Context, arg FetchAMPSubInvoiceHTLCsParams) ([]FetchAMPSubInvoiceHTLCsRow, error)
FetchAMPSubInvoices(ctx context.Context, arg FetchAMPSubInvoicesParams) ([]AmpSubInvoice, error)
// Fetch all inflight attempts across all payments
+3
View File
@@ -352,3 +352,6 @@ VALUES (
@htlc_fail_reason,
@failure_msg
);
-- name: FailPayment :execresult
UPDATE payments SET fail_reason = $1 WHERE payment_identifier = $2;