commands: use StringSlice flag for send payment

In this commit we replace the Int64Slice flag with StringSlice for
chan id flag, in sendpayment request.
This commit is contained in:
Abdullahi Yunus
2025-07-21 20:58:03 +01:00
parent 4751016839
commit 40fe9e9ce3

View File

@@ -183,13 +183,13 @@ func PaymentFlags() []cli.Flag {
cancelableFlag,
cltvLimitFlag,
lastHopFlag,
cli.Int64SliceFlag{
cli.StringSliceFlag{
Name: "outgoing_chan_id",
Usage: "short channel id of the outgoing channel to " +
"use for the first hop of the payment; can " +
"be specified multiple times in the same " +
"command",
Value: &cli.Int64Slice{},
Value: &cli.StringSlice{},
},
cli.BoolFlag{
Name: "force, f",
@@ -521,12 +521,11 @@ func SendPaymentRequest(ctx *cli.Context, req *routerrpc.SendPaymentRequest,
lnClient := lnrpc.NewLightningClient(lnConn)
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)
}
var err error
outChan := ctx.StringSlice("outgoing_chan_id")
req.OutgoingChanIds, err = parseChanIDs(outChan)
if err != nil {
return fmt.Errorf("unable to decode outgoing_chan_ids: %w", err)
}
if ctx.IsSet(lastHopFlag.Name) {