Skip to content

Commit

Permalink
lncli: enable multiple outgoing channel ids in payments
Browse files Browse the repository at this point in the history
  • Loading branch information
markettes committed Dec 18, 2023
1 parent 4fa483f commit 72a56f5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/lncli/cmd_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ func paymentFlags() []cli.Flag {
},
cltvLimitFlag,
lastHopFlag,
cli.Uint64Flag{
cli.Int64SliceFlag{
Name: "outgoing_chan_id",
Usage: "short channel id of the outgoing channel to " +
"use for the first hop of the payment",
Value: 0,
"use for the first hop of the payment; can " +
"be specified multiple times in the same " +
"command",
Value: &cli.Int64Slice{},
},
cli.BoolFlag{
Name: "force, f",
Expand Down Expand Up @@ -463,10 +465,14 @@ func sendPaymentRequest(ctx *cli.Context,
client := lnrpc.NewLightningClient(conn)
routerClient := routerrpc.NewRouterClient(conn)

outChan := ctx.Uint64("outgoing_chan_id")
if outChan != 0 {
req.OutgoingChanIds = []uint64{outChan}
outChan := ctx.Int64Slice("outgoing_chan_id")
if len(outChan) != 0 {
req.OutgoingChanIds = make([]uint64, len(outChan))
for i, c := range outChan {
req.OutgoingChanIds[i] = uint64(c)
}
}

if ctx.IsSet(lastHopFlag.Name) {
lastHop, err := route.NewVertexFromStr(
ctx.String(lastHopFlag.Name),
Expand Down

0 comments on commit 72a56f5

Please sign in to comment.