cmd/utils: fix handling of boolean flags when they are set to false #33338 (#1859)

This commit is contained in:
wit liu 2025-12-12 19:25:21 +08:00 committed by GitHub
parent 69d8d042e6
commit 07c6262d42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1280,7 +1280,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
cfg.MaxPendingPeers = ctx.Int(MaxPendingPeersFlag.Name)
}
if ctx.IsSet(NoDiscoverFlag.Name) {
cfg.NoDiscovery = true
cfg.NoDiscovery = ctx.Bool(NoDiscoverFlag.Name)
}
flags.CheckExclusive(ctx, DiscoveryV5Flag, NoDiscoverFlag)