mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #209 from joostjager/fix-loop-cli-parse
cmd/loop: fix channel parsing
This commit is contained in:
commit
bdfd382dec
1 changed files with 12 additions and 7 deletions
|
|
@ -89,15 +89,20 @@ func loopOut(ctx *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Parse outgoing channel set.
|
||||
chanStrings := strings.Split(ctx.String("channel"), ",")
|
||||
// Parse outgoing channel set. Don't string split if the flag is empty.
|
||||
// Otherwise strings.Split returns a slice of length one with an empty
|
||||
// element.
|
||||
var outgoingChanSet []uint64
|
||||
for _, chanString := range chanStrings {
|
||||
chanID, err := strconv.ParseUint(chanString, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
if ctx.IsSet("channel") {
|
||||
chanStrings := strings.Split(ctx.String("channel"), ",")
|
||||
for _, chanString := range chanStrings {
|
||||
chanID, err := strconv.ParseUint(chanString, 10, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing channel id "+
|
||||
"\"%v\"", chanString)
|
||||
}
|
||||
outgoingChanSet = append(outgoingChanSet, chanID)
|
||||
}
|
||||
outgoingChanSet = append(outgoingChanSet, chanID)
|
||||
}
|
||||
|
||||
var destAddr string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue