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.
This commit is contained in:
Felix Lange 2024-03-04 14:07:41 +01:00 committed by GitHub
parent 35cebc1687
commit a97d622588
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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