diff --git a/CHANGE-9952.md b/CHANGE-9952.md new file mode 100644 index 00000000000..a05dd702a4c --- /dev/null +++ b/CHANGE-9952.md @@ -0,0 +1,35 @@ +# LND #9952 Implementation Guide + +## Changes Needed + +### 1. lnrpc/routerrpc/router.proto +Add to `QueryRoutesRequest`: +```protobuf +bytes payment_addr = 15; +``` + +Add to `SendToRouteRequest`: +```protobuf +MPPRecord mpp_record = 3; +``` + +### 2. lnrpc/lightning.proto +Ensure MPPRecord is defined: +```protobuf +message MPPRecord { + bytes payment_addr = 1; + uint64 total_amt_msat = 2; +} +``` + +### 3. routing/router.go +Update `QueryRoutes` to include MPP record. + +### 4. cmd/lncli/commands.go +Add flags for payment_addr. + +## Generate & Test +```bash +make rpc +make check +``` diff --git a/cmd/commands/cmd_payments.go b/cmd/commands/cmd_payments.go index be7dc3d8c55..aa8ce24739d 100644 --- a/cmd/commands/cmd_payments.go +++ b/cmd/commands/cmd_payments.go @@ -1187,6 +1187,12 @@ var queryRoutesCommand = cli.Command{ `"fee_proportional_millionths":3,` + `"cltv_expiry_delta":4}]}]'`, }, + cli.StringFlag{ + Name: "payment_addr", + Usage: "(optional) the 32-byte payment address for MPP " + + "payments. When provided, the route will include " + + "the MPP record with this payment address.", + }, }, Action: actionDecorator(queryRoutes), } @@ -1280,6 +1286,16 @@ func queryRoutes(ctx *cli.Context) error { BlindedPaymentPaths: blindedRoutes, } + // Parse payment_addr if provided + if ctx.IsSet("payment_addr") { + paymentAddrHex := ctx.String("payment_addr") + paymentAddr, err := hex.DecodeString(paymentAddrHex) + if err != nil { + return fmt.Errorf("unable to decode payment_addr: %w", err) + } + req.PaymentAddr = paymentAddr + } + outgoingChanIds := ctx.StringSlice("outgoing_chan_id") req.OutgoingChanIds, err = parseChanIDs(outgoingChanIds) if err != nil { diff --git a/lnrpc/lightning.proto b/lnrpc/lightning.proto index b60f45e0950..2c2b1cc6ee2 100644 --- a/lnrpc/lightning.proto +++ b/lnrpc/lightning.proto @@ -3360,6 +3360,13 @@ message QueryRoutesRequest { channel may be used. */ repeated uint64 outgoing_chan_ids = 20; + + /* + An optional payment address to be included in the MPP record for the + queried route. This is used for multi-path payments where the same + payment_addr must be used across all subpayments. + */ + bytes payment_addr = 21; } message NodePair { diff --git a/lnrpc/routerrpc/router.proto b/lnrpc/routerrpc/router.proto index 5ddf9226143..835bb5b4a7b 100644 --- a/lnrpc/routerrpc/router.proto +++ b/lnrpc/routerrpc/router.proto @@ -489,6 +489,13 @@ message SendToRouteRequest { base64. */ map first_hop_custom_records = 4; + + /* + An optional MPP record to include with the payment. This allows sending + multi-path payments via SendToRoute by specifying the payment address + and total amount. + */ + lnrpc.MPPRecord mpp_record = 5; } message SendToRouteResponse {