From d70a57478037250dc8ec86c82fcf39c28ca67159 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 13 Jan 2023 10:40:39 +0100 Subject: [PATCH] Increase trampoline fee if we receive TEMPORARY_CHANNEL_FAILURE Sometimes the trampoline node fails to send a payment and returns TEMPORARY_CHANNEL_FAILURE, while it succeeds with a higher trampoline fee. My guess is that the initial fee was not sufficient to try all routes, and that a higher fee allows to use extra routes. I suppose it would make more sense if the trampoline node returned TRAMPOLINE_FEE_INSUFFICIENT in that case. --- electrum/lnworker.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 0c95d1045..be14b92df 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1317,9 +1317,12 @@ class LNWallet(LNWorker): # Some of the errors might depend on how we have chosen them. # Having more attempts is currently useful in part because of the randomness, # instead we should give feedback to create_routes_for_payment. + # Sometimes the trampoline node fails to send a payment and returns + # TEMPORARY_CHANNEL_FAILURE, while it succeeds with a higher trampoline fee. if code in ( OnionFailureCode.TRAMPOLINE_FEE_INSUFFICIENT, - OnionFailureCode.TRAMPOLINE_EXPIRY_TOO_SOON): + OnionFailureCode.TRAMPOLINE_EXPIRY_TOO_SOON, + OnionFailureCode.TEMPORARY_CHANNEL_FAILURE): # TODO: parse the node policy here (not returned by eclair yet) # TODO: erring node is always the first trampoline even if second # trampoline demands more fees, we can't influence this @@ -1329,8 +1332,7 @@ class LNWallet(LNWorker): use_two_trampolines = False elif code in ( OnionFailureCode.UNKNOWN_NEXT_PEER, - OnionFailureCode.TEMPORARY_NODE_FAILURE, - OnionFailureCode.TEMPORARY_CHANNEL_FAILURE): + OnionFailureCode.TEMPORARY_NODE_FAILURE): trampoline_route = htlc_log.route r = [hop.end_node.hex() for hop in trampoline_route] self.logger.info(f'failed trampoline route: {r}')