|
67 | 67 | NUM_MAX_EDGES_IN_PAYMENT_PATH, SENT, RECEIVED, HTLCOwner, |
68 | 68 | UpdateAddHtlc, Direction, LnFeatures, ShortChannelID, |
69 | 69 | HtlcLog, derive_payment_secret_from_payment_preimage, |
70 | | - NoPathFound, InvalidGossipMsg) |
| 70 | + NoPathFound, InvalidGossipMsg, FeeBudgetExceeded) |
71 | 71 | from .lnutil import ln_compare_features, IncompatibleLightningFeatures, PaymentFeeBudget |
72 | 72 | from .transaction import PartialTxOutput, PartialTransaction, PartialTxInput |
73 | 73 | from .lnonion import decode_onion_error, OnionFailureCode, OnionRoutingFailure, OnionPacket |
@@ -1880,7 +1880,7 @@ async def create_routes_for_payment( |
1880 | 1880 | and mpp is supported by the receiver, we will split the payment.""" |
1881 | 1881 | trampoline_features = LnFeatures.VAR_ONION_OPT |
1882 | 1882 | local_height = self.network.get_local_height() |
1883 | | - fee_related_error = False |
| 1883 | + fee_related_error = None # type: Optional[FeeBudgetExceeded] |
1884 | 1884 | if channels: |
1885 | 1885 | my_active_channels = channels |
1886 | 1886 | else: |
@@ -1973,7 +1973,7 @@ async def create_routes_for_payment( |
1973 | 1973 | if per_trampoline_fees != 0: |
1974 | 1974 | e = 'not enough margin to pay trampoline fee' |
1975 | 1975 | self.logger.info(e) |
1976 | | - raise NoPathFound(e, maybe_fee_related=True) |
| 1976 | + raise FeeBudgetExceeded(e) |
1977 | 1977 | else: |
1978 | 1978 | # We atomically loop through a split configuration. If there was |
1979 | 1979 | # a failure to find a path for a single part, we try the next configuration |
@@ -2004,13 +2004,17 @@ async def create_routes_for_payment( |
2004 | 2004 | trampoline_route=None, |
2005 | 2005 | ) |
2006 | 2006 | routes.append((shi, paysession.min_final_cltv_delta, fwd_trampoline_onion)) |
2007 | | - except NoPathFound as e: |
2008 | | - fee_related_error = e.maybe_fee_related |
| 2007 | + except NoPathFound: |
| 2008 | + continue |
| 2009 | + except FeeBudgetExceeded as e: |
| 2010 | + fee_related_error = e |
2009 | 2011 | continue |
2010 | 2012 | for route in routes: |
2011 | 2013 | yield route |
2012 | 2014 | return |
2013 | | - raise NoPathFound(maybe_fee_related=fee_related_error) |
| 2015 | + if fee_related_error is not None: |
| 2016 | + raise fee_related_error |
| 2017 | + raise NoPathFound() |
2014 | 2018 |
|
2015 | 2019 | @profiler |
2016 | 2020 | def create_route_for_single_htlc( |
@@ -2082,7 +2086,7 @@ def create_route_for_single_htlc( |
2082 | 2086 | route, budget=budget, amount_msat_for_dest=amount_msat, cltv_delta_for_dest=min_final_cltv_delta, |
2083 | 2087 | ): |
2084 | 2088 | self.logger.info(f"rejecting route (exceeds budget): {route=}. {budget=}") |
2085 | | - raise NoPathFound(maybe_fee_related=True) |
| 2089 | + raise FeeBudgetExceeded() |
2086 | 2090 | assert len(route) > 0 |
2087 | 2091 | if route[-1].end_node != invoice_pubkey: |
2088 | 2092 | raise LNPathInconsistent("last node_id != invoice pubkey") |
|
0 commit comments