HTLC max in flight exceeded when sending LN payments
Tried to send about $100 to Coingate via LN. I have $400 in outgoing LN channel capacity across the Electrum and ACINQ trampolines.
Payment failed due to:
electrum/lnchannel.py
952 if current_htlc_sum + amount_msat > chan_config.max_htlc_value_in_flight_msat:
953 raise PaymentFailure(f'HTLC value sum (sum of pending htlcs: {current_htlc_sum/1000} sat '
954 f'plus new htlc: {amount_msat/1000} sat) '
955 f'would exceed max allowed: {chan_config.max_htlc_value_in_flight_msat/1000} sat')
Not sure why
- the LN router is choosing channels such that the channel limit are exceeded?
- trampolines are applying value in flight limits at all?
I think that in mpp_split, suggest_splits returns configurations that violate in flight limits.
I guess suggest_splits should call channel.can_pay()
It's not just mpp_split. When lnworker.create_route_for_payment is called, in the non-mpp case, the channel chosen by mpp_split is not even passed.
https://github.com/spesmilo/electrum/blob/307cf25fd415c3d83139118c93d16f6e2e46b6db/electrum/lnworker.py#L1875
A comment would be nice to explain the reasoning. Maybe the idea was to let lnrouter choose as it might have more info about the channels. Maybe there should be more feedback/integration between lnrouter and mpp_split.
There is another example of this in https://github.com/spesmilo/electrum/issues/8830, with more details there