Skip to content

Commit 50f34f1

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 72b813e commit 50f34f1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cmd/commands/cmd_payments.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,16 +1286,13 @@ func queryRoutes(ctx *cli.Context) error {
12861286

12871287
outgoingChanIds := ctx.StringSlice("outgoing_chan_id")
12881288
if len(outgoingChanIds) != 0 {
1289-
req.OutgoingChanIds = make([]uint64, len(outgoingChanIds))
1290-
for i, chanID := range outgoingChanIds {
1291-
id, err := strconv.ParseUint(chanID, 10, 64)
1292-
if err != nil {
1293-
return fmt.Errorf("invalid outgoing_chan_id "+
1294-
"argument: %w", err)
1295-
}
1296-
1297-
req.OutgoingChanIds[i] = id
1289+
chanIDs, err := parseChanIDs(outgoingChanIds)
1290+
if err != nil {
1291+
return fmt.Errorf("unable to decode "+
1292+
"outgoing_chan_id: %w", err)
12981293
}
1294+
1295+
req.OutgoingChanIds = chanIDs
12991296
}
13001297

13011298
if ctx.IsSet("route_hints") {

0 commit comments

Comments
 (0)