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.
This commit is contained in:
f321x
2026-03-27 18:05:00 +01:00
parent d33212656f
commit 11f0a68c96
+2
View File
@@ -224,6 +224,8 @@ def create_trampoline_route(
) -> LNPaymentTRoute: ) -> LNPaymentTRoute:
# we decide whether to convert to a legacy payment # we decide whether to convert to a legacy payment
is_legacy, invoice_trampolines = is_legacy_relay(invoice_features, r_tags) 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=}") _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 # we build a route of trampoline hops and extend the route list in place