Skip to content

Commit 72b813e

Browse files
committed
commands: use StringSlice flag for send payment
In this commit we replace the Int64Slice flag with StringSlice for payments commands.
1 parent 5335c16 commit 72b813e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmd/commands/cmd_payments.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ func PaymentFlags() []cli.Flag {
183183
cancelableFlag,
184184
cltvLimitFlag,
185185
lastHopFlag,
186-
cli.Int64SliceFlag{
186+
cli.StringSliceFlag{
187187
Name: "outgoing_chan_id",
188188
Usage: "short channel id of the outgoing channel to " +
189189
"use for the first hop of the payment; can " +
190190
"be specified multiple times in the same " +
191191
"command",
192-
Value: &cli.Int64Slice{},
192+
Value: &cli.StringSlice{},
193193
},
194194
cli.BoolFlag{
195195
Name: "force, f",
@@ -521,12 +521,15 @@ func SendPaymentRequest(ctx *cli.Context, req *routerrpc.SendPaymentRequest,
521521

522522
lnClient := lnrpc.NewLightningClient(lnConn)
523523

524-
outChan := ctx.Int64Slice("outgoing_chan_id")
524+
outChan := ctx.StringSlice("outgoing_chan_id")
525525
if len(outChan) != 0 {
526-
req.OutgoingChanIds = make([]uint64, len(outChan))
527-
for i, c := range outChan {
528-
req.OutgoingChanIds[i] = uint64(c)
526+
chanIDs, err := parseChanIDs(outChan)
527+
if err != nil {
528+
return fmt.Errorf("unable to decode "+
529+
"outgoing_chan_ids: %w", err)
529530
}
531+
532+
req.OutgoingChanIds = chanIDs
530533
}
531534

532535
if ctx.IsSet(lastHopFlag.Name) {

0 commit comments

Comments
 (0)