From f262d46d1f7508f1e5900e14d53165c35dd401e3 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Wed, 4 Feb 2026 17:58:29 +0000 Subject: [PATCH] fixes --- src/services/lnd/swaps/swaps.ts | 6 +++++- src/services/main/index.ts | 2 ++ src/services/serverMethods/index.ts | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/services/lnd/swaps/swaps.ts b/src/services/lnd/swaps/swaps.ts index 79a3f408..ba9b7f5b 100644 --- a/src/services/lnd/swaps/swaps.ts +++ b/src/services/lnd/swaps/swaps.ts @@ -170,7 +170,11 @@ export class Swaps { const swaps = await this.storage.paymentStorage.ListUnfinishedInvoiceSwaps() this.log("resuming", swaps.length, "invoice 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) + } } } diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 3d885681..6f136e09 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -163,6 +163,8 @@ export default class { let log = getLogger({}) this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height) .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 { const balanceEvents = await this.paymentManager.GetLndBalance() if (!skipMetrics) { diff --git a/src/services/serverMethods/index.ts b/src/services/serverMethods/index.ts index 47624db7..21668449 100644 --- a/src/services/serverMethods/index.ts +++ b/src/services/serverMethods/index.ts @@ -111,11 +111,18 @@ export default (mainHandler: Main): Types.ServerMethods => { }, GetAdminInvoiceSwapQuotes: async ({ ctx, req }) => { const err = Types.InvoiceSwapRequestValidate(req, { - invoice_CustomCheck: invoice => invoice !== '' + amount_sats_CustomCheck: amt => amt > 0 }) if (err != null) throw new Error(err.message) 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 }) => { return mainHandler.adminManager.ListAdminInvoiceSwaps() },