From be94ea1c4028f82b90de5f1e08a40f0b0a73d5da Mon Sep 17 00:00:00 2001 From: cui Date: Tue, 2 Dec 2025 23:11:56 +0800 Subject: [PATCH] cmd/utils: fix handling of boolean flags when they are set to false (#33338) geth --nodiscover=false may result in ctx.IsSet(NoDiscoverFlag.Name) is true, but cfg. NoDiscovery should be false, not true. --- cmd/utils/flags.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 0d53716f6c..b73fa80b17 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1374,7 +1374,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, DiscoveryV4Flag, NoDiscoverFlag) @@ -1724,7 +1724,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { cfg.LogHistory = ctx.Uint64(LogHistoryFlag.Name) } if ctx.IsSet(LogNoHistoryFlag.Name) { - cfg.LogNoHistory = true + cfg.LogNoHistory = ctx.Bool(LogNoHistoryFlag.Name) } if ctx.IsSet(LogSlowBlockFlag.Name) { cfg.SlowBlockThreshold = ctx.Duration(LogSlowBlockFlag.Name)