Skip to content

multi: support MPP and AMP records in QueryRoutes, BuildRoute and Sen…#10801

Open
murraystewart96 wants to merge 8 commits into
lightningnetwork:masterfrom
murraystewart96:9952-mpp-record-rpc-support
Open

multi: support MPP and AMP records in QueryRoutes, BuildRoute and Sen…#10801
murraystewart96 wants to merge 8 commits into
lightningnetwork:masterfrom
murraystewart96:9952-mpp-record-rpc-support

Conversation

@murraystewart96
Copy link
Copy Markdown

…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

📝 Please see our Contribution Guidelines for further guidance.

…dToRoute

Closes lightningnetwork#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.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! 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 👍 and 👎 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.

Footnotes

  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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Multi-Path Payments (MPP) and Atomic Multi-Path (AMP) records across the routing and RPC layers by introducing payment_addr and amp_record fields to QueryRoutesRequest and BuildRouteRequest. These records are now injected into the final hop of generated routes, and SendToRouteV2 has been updated to enforce mandatory MPP records. Review feedback highlights a critical logic error in BuildRoute that prevents AMP record processing, identifies missing length validations for payment_addr which could lead to panics, and notes a style guide violation in unit tests where manual error checks should be replaced with the require library.

Comment thread lnrpc/routerrpc/router_server.go
Comment thread lnrpc/routerrpc/router_backend.go
Comment thread lnrpc/routerrpc/router_server.go Outdated
Comment thread routing/pathfind_test.go Outdated
…dToRoute

- validating payment addr length before casting
…dToRoute

- ensuring payment_addr is 32 bytes
- using require for test assertion
@github-actions github-actions Bot added the severity-high Requires knowledgeable engineer review label May 12, 2026
@github-actions
Copy link
Copy Markdown

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 -->

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

Labels

severity-high Requires knowledgeable engineer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Support MPP record (alias Payment_Address) for more RPC calls

1 participant