Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGE-9952.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# LND #9952 Implementation Guide

## Changes Needed

### 1. lnrpc/routerrpc/router.proto
Add to `QueryRoutesRequest`:
```protobuf
bytes payment_addr = 15;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Field number 15 is already occupied by last_hop_pubkey in QueryRoutesRequest (see lnrpc/lightning.proto line 3327). Additionally, QueryRoutesRequest is defined in lnrpc/lightning.proto, not lnrpc/routerrpc/router.proto. Please use the next available field number, which is 21, in the correct file.

Suggested change
bytes payment_addr = 15;
bytes payment_addr = 21;

```

Add to `SendToRouteRequest`:
```protobuf
MPPRecord mpp_record = 3;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Field number 3 is already occupied by skip_temp_err in SendToRouteRequest (see lnrpc/routerrpc/router.proto line 482). Please use the next available field number, which is 5.

Suggested change
MPPRecord mpp_record = 3;
MPPRecord mpp_record = 5;

```

### 2. lnrpc/lightning.proto
Ensure MPPRecord is defined:
```protobuf
message MPPRecord {
bytes payment_addr = 1;
uint64 total_amt_msat = 2;
}
Comment on lines +19 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The MPPRecord message is already defined in lnrpc/lightning.proto (lines 3488-3505) with field numbers 11 and 10. Redefining it with field numbers 1 and 2 would be a breaking change and is inconsistent with the existing definition. This section should be updated to match the existing definition or removed.

```

### 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
```
16 changes: 16 additions & 0 deletions cmd/commands/cmd_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions lnrpc/lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions lnrpc/routerrpc/router.proto
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,13 @@ message SendToRouteRequest {
base64.
*/
map<uint64, bytes> 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 {
Expand Down
Loading