This commit is contained in:
boufni95 2026-02-04 17:58:29 +00:00
parent f5eb1f3253
commit f262d46d1f
3 changed files with 15 additions and 2 deletions

View file

@ -170,7 +170,11 @@ export class Swaps {
const swaps = await this.storage.paymentStorage.ListUnfinishedInvoiceSwaps() const swaps = await this.storage.paymentStorage.ListUnfinishedInvoiceSwaps()
this.log("resuming", swaps.length, "invoice swaps") this.log("resuming", swaps.length, "invoice swaps")
for (const swap of swaps) { for (const swap of swaps) {
this.resumeInvoiceSwap(swap) try {
this.resumeInvoiceSwap(swap)
} catch (err: any) {
this.log("error resuming invoice swap", err.message || err)
}
} }
} }

View file

@ -163,6 +163,8 @@ export default class {
let log = getLogger({}) let log = getLogger({})
this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height) this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height)
.catch(err => log(ERROR, "failed to delete expired transaction swaps", err.message || err)) .catch(err => log(ERROR, "failed to delete expired transaction swaps", err.message || err))
this.storage.paymentStorage.DeleteExpiredInvoiceSwaps(height)
.catch(err => log(ERROR, "failed to delete expired invoice swaps", err.message || err))
try { try {
const balanceEvents = await this.paymentManager.GetLndBalance() const balanceEvents = await this.paymentManager.GetLndBalance()
if (!skipMetrics) { if (!skipMetrics) {

View file

@ -111,11 +111,18 @@ export default (mainHandler: Main): Types.ServerMethods => {
}, },
GetAdminInvoiceSwapQuotes: async ({ ctx, req }) => { GetAdminInvoiceSwapQuotes: async ({ ctx, req }) => {
const err = Types.InvoiceSwapRequestValidate(req, { const err = Types.InvoiceSwapRequestValidate(req, {
invoice_CustomCheck: invoice => invoice !== '' amount_sats_CustomCheck: amt => amt > 0
}) })
if (err != null) throw new Error(err.message) if (err != null) throw new Error(err.message)
return mainHandler.adminManager.GetAdminInvoiceSwapQuotes(req) return mainHandler.adminManager.GetAdminInvoiceSwapQuotes(req)
}, },
RefundAdminInvoiceSwap: async ({ ctx, req }) => {
const err = Types.RefundAdminInvoiceSwapRequestValidate(req, {
swap_operation_id_CustomCheck: id => id !== '',
})
if (err != null) throw new Error(err.message)
return mainHandler.adminManager.RefundAdminInvoiceSwap(req)
},
ListAdminInvoiceSwaps: async ({ ctx }) => { ListAdminInvoiceSwaps: async ({ ctx }) => {
return mainHandler.adminManager.ListAdminInvoiceSwaps() return mainHandler.adminManager.ListAdminInvoiceSwaps()
}, },