cmd/devp2p: fix commandHasFlag

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-02-26 14:16:14 +01:00
parent 63aaac8100
commit e0bbf9965b

View file

@ -66,11 +66,17 @@ 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 {
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
}