From 11f0a68c960d6fe4d2d0a33acbc0331e2f3aa550 Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 27 Mar 2026 18:05:00 +0100 Subject: [PATCH] trampoline: prevent adding ourself on the route Followup #10541. Fixes tests.regtest.TestLightningSwapserver.test_swapserver_forceclose. In the regtest bob would now signal trampoline support due to #10541 and include Alice into the invoice trampoline as he is connected to Alice. Alice would then try to add herself onto the trampoline route, causing the payment to fail. --- electrum/trampoline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/electrum/trampoline.py b/electrum/trampoline.py index 78f13c551..1df250b8e 100644 --- a/electrum/trampoline.py +++ b/electrum/trampoline.py @@ -224,6 +224,8 @@ def create_trampoline_route( ) -> LNPaymentTRoute: # we decide whether to convert to a legacy payment is_legacy, invoice_trampolines = is_legacy_relay(invoice_features, r_tags) + # we can be in the invoice_trampolines e.g. if we have a direct channel with the recipient + invoice_trampolines.discard(my_pubkey) _logger.debug(f"Creating trampoline route for invoice_pubkey={invoice_pubkey.hex()}, {is_legacy=}") # we build a route of trampoline hops and extend the route list in place