From 4c93c9a26c4ecea8a3b3cc8aea5aab3031d25b34 Mon Sep 17 00:00:00 2001 From: f321x Date: Tue, 14 Jan 2025 11:12:48 +0100 Subject: [PATCH 1/2] limit payment attempts if client uses trampoline revert line break limit payment attempts if client uses trampoline --- electrum/lnworker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index a00dc12e2..e793e239b 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1497,7 +1497,7 @@ class LNWallet(LNWorker): min_final_cltv_delta=min_final_cltv_delta, r_tags=r_tags, invoice_features=invoice_features, - attempts=attempts, + attempts=20 if attempts is None and self.uses_trampoline() else attempts, full_path=full_path, channels=channels, budget=budget, From 48c53053d6b9fa415081229a10d6da24ad0913aa Mon Sep 17 00:00:00 2001 From: f321x Date: Wed, 15 Jan 2025 10:44:01 +0100 Subject: [PATCH 2/2] don't inline logic and add comment --- electrum/lnworker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index e793e239b..8840d5aaf 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1487,6 +1487,9 @@ class LNWallet(LNWorker): self.wallet.set_label(key, lnaddr.get_description()) self.set_invoice_status(key, PR_INFLIGHT) budget = PaymentFeeBudget.default(invoice_amount_msat=amount_to_pay, config=self.config) + if attempts is None and self.uses_trampoline(): + # we don't expect lots of failed htlcs with trampoline, so we can fail sooner + attempts = 30 success = False try: await self.pay_to_node( @@ -1497,7 +1500,7 @@ class LNWallet(LNWorker): min_final_cltv_delta=min_final_cltv_delta, r_tags=r_tags, invoice_features=invoice_features, - attempts=20 if attempts is None and self.uses_trampoline() else attempts, + attempts=attempts, full_path=full_path, channels=channels, budget=budget,