Skip to content

Commit 35c6cec

Browse files
committed
commands: use parseChanIDs method
In this commit we use the `parseChanIDs` method introduced in a previous commit to process the `outgoing_chan_id` flag for `queryroutes`.
1 parent 40fe9e9 commit 35c6cec

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

cmd/commands/cmd_payments.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,17 +1281,9 @@ func queryRoutes(ctx *cli.Context) error {
12811281
}
12821282

12831283
outgoingChanIds := ctx.StringSlice("outgoing_chan_id")
1284-
if len(outgoingChanIds) != 0 {
1285-
req.OutgoingChanIds = make([]uint64, len(outgoingChanIds))
1286-
for i, chanID := range outgoingChanIds {
1287-
id, err := strconv.ParseUint(chanID, 10, 64)
1288-
if err != nil {
1289-
return fmt.Errorf("invalid outgoing_chan_id "+
1290-
"argument: %w", err)
1291-
}
1292-
1293-
req.OutgoingChanIds[i] = id
1294-
}
1284+
req.OutgoingChanIds, err = parseChanIDs(outgoingChanIds)
1285+
if err != nil {
1286+
return fmt.Errorf("unable to decode outgoing_chan_id: %w", err)
12951287
}
12961288

12971289
if ctx.IsSet("route_hints") {

0 commit comments

Comments
 (0)