cmd/devp2p: fix commandHasFlag (#29091)

It got broken in some update of the cli library, and thus bootnodes weren't 
being configured automatically for some of the discovery commands.
pull/29165/head
Felix Lange 9 months ago committed by GitHub
parent 35cebc1687
commit a97d622588
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      cmd/devp2p/main.go

@ -66,9 +66,15 @@ func commandHasFlag(ctx *cli.Context, flag cli.Flag) bool {
for _, name := range names {
set[name] = struct{}{}
}
for _, fn := range ctx.FlagNames() {
if _, ok := set[fn]; ok {
return true
for _, ctx := range ctx.Lineage() {
if ctx.Command != nil {
for _, f := range ctx.Command.Flags {
for _, name := range f.Names() {
if _, ok := set[name]; ok {
return true
}
}
}
}
}
return false

Loading…
Cancel
Save