multi: support MPP and AMP records in QueryRoutes, BuildRoute and Sen…
…dToRoute
Closes #9952
- Add payment_addr field to QueryRoutesRequest to allow callers to include the invoice payment secret. The MPP record is injected into the final hop of the returned route.
- Add amp_record field to QueryRoutesRequest and BuildRouteRequest.
- Enforce that SendToRouteV2 and BuildRoute require a payment_addr, as payment_secret is now mandatory per the BOLT 11 spec.
- Add AMP record support to BuildRoute, threading it through finalHopParams into newRoute with a feature check against the destination node.
Change Description
Description of change / link to associated issue.
Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
- [ ] Your PR passes all CI checks.
- [ x] Tests covering the positive and negative (error paths) are included.
- [ ] Bug fixes contain tests triggering the bug to prevent regressions.
Code Style and Documentation
- [x ] The change is not insubstantial. Typo fixes are not accepted to fight bot spam.
- [x ] The change obeys the Code Documentation and Commenting guidelines, and lines wrap at 80.
- [ ] Commits follow the Ideal Git Commit Structure.
- [ ] Any new logging statements use an appropriate subsystem and logging level.
- [ ] Any new lncli commands have appropriate tags in the comments for the rpc in the proto file.
- [ x] There is a change description in the release notes, or
[skip ci]in the commit message for small changes.
📝 Please see our Contribution Guidelines for further guidance.
Summary of Changes
Hello, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces support for Multi-Path Payment (MPP) and Atomic Multi-Path (AMP) records within the routing layer. By updating the RPC definitions and internal route-building logic, the changes allow callers to provide necessary payment secrets and AMP records, which are then correctly injected into the final hop of a route. These updates ensure the system remains compliant with current BOLT 11 standards while providing robust validation for new payment types.
Highlights
- RPC Interface Updates: Added payment_addr and amp_record fields to QueryRoutesRequest and BuildRouteRequest to support advanced payment features.
- Validation and Enforcement: Enforced mandatory payment_addr in SendToRouteV2 and BuildRoute to ensure compliance with BOLT 11 specifications.
- AMP Record Integration: Implemented logic to thread AMP records through the route-building process and inject them into the final hop of a payment route.
- Testing and Verification: Added comprehensive test coverage for both positive and negative paths regarding MPP and AMP record injection.
New Features
🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
PR Severity: HIGH. Files: lnrpc/lightning.proto, lnrpc/lightning.swagger.json, lnrpc/routerrpc/router.proto, lnrpc/routerrpc/router.swagger.json, lnrpc/routerrpc/router_backend.go, lnrpc/routerrpc/router_server.go (all HIGH via lnrpc/), routing/pathfind.go, routing/router.go (HIGH via routing/). 9 non-excluded files, ~143 non-excluded lines - no bump. <!-- pr-severity-bot -->
@murraystewart96, remember to re-request review from reviewers when ready