Skip to content

Commit be94ea1

Browse files
authored
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.
1 parent 042c47c commit be94ea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/utils/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
13741374
cfg.MaxPendingPeers = ctx.Int(MaxPendingPeersFlag.Name)
13751375
}
13761376
if ctx.IsSet(NoDiscoverFlag.Name) {
1377-
cfg.NoDiscovery = true
1377+
cfg.NoDiscovery = ctx.Bool(NoDiscoverFlag.Name)
13781378
}
13791379

13801380
flags.CheckExclusive(ctx, DiscoveryV4Flag, NoDiscoverFlag)
@@ -1724,7 +1724,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
17241724
cfg.LogHistory = ctx.Uint64(LogHistoryFlag.Name)
17251725
}
17261726
if ctx.IsSet(LogNoHistoryFlag.Name) {
1727-
cfg.LogNoHistory = true
1727+
cfg.LogNoHistory = ctx.Bool(LogNoHistoryFlag.Name)
17281728
}
17291729
if ctx.IsSet(LogSlowBlockFlag.Name) {
17301730
cfg.SlowBlockThreshold = ctx.Duration(LogSlowBlockFlag.Name)

0 commit comments

Comments
 (0)