Skip to content

Consider existing in-flight HTLCs when routing #1267

Closed

Description

@TheBlueMatt

lnd has a very long-standing bug where if you go to send a payment and it decides to split the payment, it may try to send both over the same channel, even if the channel does not have sufficient capacity to handle both parts. Instead, one part will be sent, and the other part will fail, leaving the payment to wait until the MPP times out. This is worse when paying an LDK client because of #1050. However, even on the sending side I believe we actually have the same bug. We should check for this and figure out how to handle this.

Activity

  1. modified the milestones: 0.1, 0.1.1 on Jan 19, 2022
  2. jkczyz commented on May 17, 2022

    @jkczyz
    Contributor

    However, even on the sending side I believe we actually have the same bug. We should check for this and figure out how to handle this.

    Is bookkept_channels_liquidity_available_msat (renamed in #1456 ) suppose to handles this?

    let mut bookkept_channels_liquidity_available_msat = HashMap::with_capacity(network_nodes.len());

    (cc: @jurvis)

  3. TheBlueMatt commented on May 17, 2022

    @TheBlueMatt
    CollaboratorAuthor

    Yes, that handles it in the first route fetch, but we don't do any kind of bookkeeping across path retries. I'll be honest I'm not 100% sure what I was referring to here, but I think it was on retry, or certainly that would make sense.

  4. jkczyz commented on Jun 15, 2022

    @jkczyz
    Contributor

    @jurvis and I were chatting about this recently. IIUC, the problem can be more generally stated as accounting for known in-flight HTLCs across all our outstanding payments. Either way, the question may be how to keep track of this and what that means for the find_route / Router API.

    One idea would be to track these in-flight HTLCs either separately or as part of the NetworkGraph. Perhaps the EventHandler implementation for NetworkGraph could manage this accounting. Thoughts?

  5. jkczyz commented on Jun 15, 2022

    @jkczyz
    Contributor

    One idea would be to track these in-flight HTLCs either separately or as part of the NetworkGraph. Perhaps the EventHandler implementation for NetworkGraph could manage this accounting. Thoughts?

    Ah, but that would only be helpful for removing HTLCs which are no longer in flight. Adding them would require a mutable NetworkGraph. So maybe an auxiliary data structure would be needed.

    Edit: Hmmm... such a data structure would need to be mutated when actually sending the payment (i.e., in ChannelManager). The coordination seems complicated. 🙁

  6. TheBlueMatt commented on Jun 15, 2022

    @TheBlueMatt
    CollaboratorAuthor

    Yea it's really not clear to me what the right answer is here, I think naively the simplest approach is to store extra information in the InvoicePayer that can then be passed to find_route, some kind of in-flight tracking struct which can be efficiently queried for channel balance information.

  7. tnull commented on Jun 16, 2022

    @tnull
    Contributor

    I think an issue I encountered in #1526 is somewhat related: when calculating the minimum per-path value contribution, it would be nice to do this dynamically, i.e., allow a lower contribution for subsequent paths, if we have collected paths that contribute a good amount already. However, this is currently hard to do with the current logic in get_route, since at the time of collecting/checking paths we're not aware which other paths will end up in the final route. If we as of this issue would find a way to reliably track the state of all the MPP arms during routing, it may be worth having another look at this.

  8. changed the title [-]Evaluate Payment Split Reliability[/-] [+]Consider existing in-flight HTLCs when routing[/+] on Jul 12, 2022
  9. tnull commented on May 20, 2023

    @tnull
    Contributor

    Closing as addressed in #1643.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions