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

Fix Route serialization round-trip #2897

Merged
merged 4 commits into from
Feb 16, 2024

Commits on Feb 16, 2024

  1. Drop the fails_paying_for_bolt12_invoice test

    `fails_paying_for_bolt12_invoice` tests that we fail to send a
    payment if the router returns `Ok` but includes a bogus route (one
    with 0-length paths). While this marginally increases our test
    coverage, in the next commit we'll be testing that all routes
    round-trip serialization, which fails here as bogus routes are not
    supported in deserialization.
    
    Because this isn't particularly critical test coverage, we simply
    opt to drop the test entirely here.
    TheBlueMatt committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    f3067b8 View commit details
    Browse the repository at this point in the history
  2. Fix blinded path serialization in Route

    `Route`'s blinded_path serialization logic writes a blinded path
    `Option` per path hop, however on read we (correctly) only read one
    blinded path `Option` per path. This causes serialization of
    `Route`s with blinded paths to fail to round-trip.
    
    Here we fix this by writing blinded paths per path.
    TheBlueMatt committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    2ada791 View commit details
    Browse the repository at this point in the history
  3. Fix Route serialization round-trip

    When the `max_total_routing_fee_msat` parameter was added to
    `RouteParameters`, the serialization used `map` to get the max fee,
    accidentally writing an `Option<Option<u64>>`, but then read it as
    an `Option<u64>`. Thus, any `Route`s with a `route_params` written
    will fail to be read back.
    
    Luckily, this is an incredibly rarely-used bit of code, so only one
    user managed to hit it.
    TheBlueMatt committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    4026d4e View commit details
    Browse the repository at this point in the history
  4. Test Route serialization round-trip

    This adds testing for the previous two commits by testing that all
    routes generated in testing are able to survive a serialization
    round-trip.
    TheBlueMatt committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    24d02ff View commit details
    Browse the repository at this point in the history