multi: implement Fail method for sql backend
This commit is contained in:
4 files changed
+83
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -352,3 +352,6 @@ VALUES (
|
||||
@htlc_fail_reason,
|
||||
@failure_msg
|
||||
);
|
||||
|
||||
-- name: FailPayment :execresult
|
||||
UPDATE payments SET fail_reason = $1 WHERE payment_identifier = $2;
|
||||
Reference in new issue
Block a user