Merge pull request #8261 from markettes/lncli-multiple-outgoing-channels

Enable multiple outgoing channel ids in payments
This commit is contained in:
Oliver Gugger 2023-12-18 11:38:46 +01:00 committed by GitHub
commit 0df507eca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -169,11 +169,13 @@ func paymentFlags() []cli.Flag {
}, },
cltvLimitFlag, cltvLimitFlag,
lastHopFlag, lastHopFlag,
cli.Uint64Flag{ cli.Int64SliceFlag{
Name: "outgoing_chan_id", Name: "outgoing_chan_id",
Usage: "short channel id of the outgoing channel to " + Usage: "short channel id of the outgoing channel to " +
"use for the first hop of the payment", "use for the first hop of the payment; can " +
Value: 0, "be specified multiple times in the same " +
"command",
Value: &cli.Int64Slice{},
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "force, f", Name: "force, f",
@ -463,10 +465,14 @@ func sendPaymentRequest(ctx *cli.Context,
client := lnrpc.NewLightningClient(conn) client := lnrpc.NewLightningClient(conn)
routerClient := routerrpc.NewRouterClient(conn) routerClient := routerrpc.NewRouterClient(conn)
outChan := ctx.Uint64("outgoing_chan_id") outChan := ctx.Int64Slice("outgoing_chan_id")
if outChan != 0 { if len(outChan) != 0 {
req.OutgoingChanIds = []uint64{outChan} req.OutgoingChanIds = make([]uint64, len(outChan))
for i, c := range outChan {
req.OutgoingChanIds[i] = uint64(c)
}
} }
if ctx.IsSet(lastHopFlag.Name) { if ctx.IsSet(lastHopFlag.Name) {
lastHop, err := route.NewVertexFromStr( lastHop, err := route.NewVertexFromStr(
ctx.String(lastHopFlag.Name), ctx.String(lastHopFlag.Name),

View file

@ -128,6 +128,11 @@
in the rpc definition to ensure that the autogenerated API documentation in the rpc definition to ensure that the autogenerated API documentation
properly specifies how to use the lncli command. properly specifies how to use the lncli command.
* [Enable multiple outgoing channel ids for the payment
command](https://github.com/lightningnetwork/lnd/pull/8261). This change adds
the ability to specify multiple outgoing channel ids for the `sendpayment`
command.
## Code Health ## Code Health
* [Remove Litecoin code](https://github.com/lightningnetwork/lnd/pull/7867). * [Remove Litecoin code](https://github.com/lightningnetwork/lnd/pull/7867).