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`.
This commit is contained in:
1 file changed
+3
-11
@@ -1281,17 +1281,9 @@ func queryRoutes(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
outgoingChanIds := ctx.StringSlice("outgoing_chan_id")
|
outgoingChanIds := ctx.StringSlice("outgoing_chan_id")
|
||||||
if len(outgoingChanIds) != 0 {
|
req.OutgoingChanIds, err = parseChanIDs(outgoingChanIds)
|
||||||
req.OutgoingChanIds = make([]uint64, len(outgoingChanIds))
|
if err != nil {
|
||||||
for i, chanID := range outgoingChanIds {
|
return fmt.Errorf("unable to decode outgoing_chan_id: %w", err)
|
||||||
id, err := strconv.ParseUint(chanID, 10, 64)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("invalid outgoing_chan_id "+
|
|
||||||
"argument: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req.OutgoingChanIds[i] = id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.IsSet("route_hints") {
|
if ctx.IsSet("route_hints") {
|
||||||
|
|||||||
Reference in new issue
Block a user