Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multi-part payments (MPP) sending support #3809

Merged
merged 20 commits into from
Jul 15, 2020
Merged

Implement multi-part payments (MPP) sending support #3809

merged 20 commits into from
Jul 15, 2020

Commits on Jul 14, 2020

  1. paymod: Allow callers to opt out of shadow routing amount fuzzing

    With MPP we require that the sum of parts is equal to the `total_msat` amount
    declared in the onion. Since that can't be changed once the first part arrives
    we need a way to disable amount fuzzing for MPP.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    187d8a1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bbb7cb7 View commit details
    Browse the repository at this point in the history
  3. tlvstream: Allow overwriting an already set value

    This is necessary in the next commit to override the total_msat that is being
    delivered to the destination.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    986c61f View commit details
    Browse the repository at this point in the history
  4. paymod: Don't assume that the first payment was executed at all

    With the `presplit`-modifier we actually skip execution of the root altogether
    which results in the root not having a result at all. Instead we should use
    the result returned by `payment_collect_result`.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    581c159 View commit details
    Browse the repository at this point in the history
  5. mpp: Add the presplit MPP modifier

    Changelog-Added: The MPP presplit modifier splits large payments into 10k satoshi parts to maximize chances of performing the payment and to obfuscate the overall amount being sent.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    50bf8eb View commit details
    Browse the repository at this point in the history
  6. paymod: Not having a result doesn't mean we failed at getroute

    Specifically if we split, there is no result, but we shouldn't add a failure
    message.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    db43faf View commit details
    Browse the repository at this point in the history
  7. retrymod: Reset retry counter if parent is a split

    If the parent is a split we have new payment parameters, and want to perform a
    number of attempts with those.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    c59ae47 View commit details
    Browse the repository at this point in the history
  8. paymod: Implement adaptive splitter

    This modifier splits a payment that has been attempted a number of times (by a
    modifier earlier in the mod chain) and has failed consistently. It splits the
    amount roughly in half, with a but if random fuzz, and then starts a new round
    of attempts for the two smaller amounts.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    123077a View commit details
    Browse the repository at this point in the history
  9. mpp: Enable adaptive splitter

    Changelog-Added: The adaptive multi-part payment modifier will split payments that are failing due to their size into smaller parts, and re-attempted.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    321a0f1 View commit details
    Browse the repository at this point in the history
  10. mpp: Add CLI option to opt-out of multi-part payments

    Several tests are not well-suited for mpp, so I added a CLI option to opt-out
    of the MPP support at startup time.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    21a06a5 View commit details
    Browse the repository at this point in the history
  11. mpp: Detect if destination supports MPP from invoice and abort early

    We abort on the root since that is the coordination point for all parts of the payment.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    5183437 View commit details
    Browse the repository at this point in the history
  12. mpp: Lower amounts below the presplit amount

    Some tests were failing because they were running into the presplit modifier
    and then surprised that the payment got split.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    00f88e5 View commit details
    Browse the repository at this point in the history
  13. mpp: Consider an abort as the payment being finished

    If one part sets the root to be aborted, there is little point in continuing
    to wait for the remainder, return to the caller immediately.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    d4dfb3e View commit details
    Browse the repository at this point in the history
  14. retrymod: Make retry modifier slightly more verbose

    I found it rather useful to trace how a payment is getting retried in the logs.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    944084c View commit details
    Browse the repository at this point in the history
  15. ld: We might not have a failing channel if localfail and sendonion

    This happens to be an edge case with the way we use `sendonion` in
    MPP. `sendonion` does not attempt to recover the route even if we supply the
    shared secrets (it'd require us to map forwarding channels to the nodes etc),
    so `failnode` will always be unset, unless it is the first hop, which gets
    stored. This is not a problem if it weren't for the fact that we don't store
    the partial route, consisting solely of the channel leading to the first hop,
    therefore the assertion that either both are NULL or both aren't fails on the
    first hop.
    
    This went unnoticed since with MPP we have more concurrent payments in flight,
    increasing the chances of a exhausted first hop considerably.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    a754af9 View commit details
    Browse the repository at this point in the history
  16. pytest: Disable MPP sending for 4 tests

    These mostly deal with exact HTLC counts, and fixed number of attempts to
    conclusion, so the randomization that MPP adds is not desirable.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    d77f3ea View commit details
    Browse the repository at this point in the history
  17. pytest: Add an adaptive MPP test

    This exercises something that is simply not possible without MPP, i.e., the
    bundling of multiple paths to get sufficient capacity to perform the payment.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    90d1dd6 View commit details
    Browse the repository at this point in the history
  18. plugin: Fix a memory leak and a missing dereference in listconfigs

    `listconfigs` calls were setting the description twice and was using the
    pointer to the boolean value as the boolean value, resulting in always
    returning `true`.
    cdecker committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    da1bcc2 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    a499621 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    4e9054b View commit details
    Browse the repository at this point in the history