Skip to content

Commit a8cfd72

Browse files
committed
cmd,node: fix overwrite
1 parent cf93077 commit a8cfd72

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

cmd/utils/flags.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,14 +859,14 @@ var (
859859
Aliases: []string{"discv4"},
860860
Usage: "Enables the V4 discovery mechanism",
861861
Category: flags.NetworkingCategory,
862-
Value: true,
862+
Value: node.DefaultConfig.P2P.DiscoveryV4,
863863
}
864864
DiscoveryV5Flag = &cli.BoolFlag{
865865
Name: "discovery.v5",
866866
Aliases: []string{"discv5"},
867867
Usage: "Enables the V5 discovery mechanism",
868868
Category: flags.NetworkingCategory,
869-
Value: true,
869+
Value: node.DefaultConfig.P2P.DiscoveryV5,
870870
}
871871
NetrestrictFlag = &cli.StringFlag{
872872
Name: "netrestrict",
@@ -1368,8 +1368,12 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
13681368

13691369
flags.CheckExclusive(ctx, DiscoveryV4Flag, NoDiscoverFlag)
13701370
flags.CheckExclusive(ctx, DiscoveryV5Flag, NoDiscoverFlag)
1371-
cfg.DiscoveryV4 = ctx.Bool(DiscoveryV4Flag.Name)
1372-
cfg.DiscoveryV5 = ctx.Bool(DiscoveryV5Flag.Name)
1371+
if ctx.IsSet(DiscoveryV4Flag.Name) {
1372+
cfg.DiscoveryV4 = ctx.Bool(DiscoveryV4Flag.Name)
1373+
}
1374+
if ctx.IsSet(DiscoveryV5Flag.Name) {
1375+
cfg.DiscoveryV5 = ctx.Bool(DiscoveryV5Flag.Name)
1376+
}
13731377

13741378
if netrestrict := ctx.String(NetrestrictFlag.Name); netrestrict != "" {
13751379
list, err := netutil.ParseNetlist(netrestrict)

node/defaults.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ var DefaultConfig = Config{
6969
BatchResponseMaxSize: 25 * 1000 * 1000,
7070
GraphQLVirtualHosts: []string{"localhost"},
7171
P2P: p2p.Config{
72-
ListenAddr: ":30303",
73-
MaxPeers: 50,
74-
NAT: nat.Any(),
72+
ListenAddr: ":30303",
73+
MaxPeers: 50,
74+
NAT: nat.Any(),
75+
DiscoveryV4: true,
76+
DiscoveryV5: true,
7577
},
7678
DBEngine: "", // Use whatever exists, will default to Pebble if non-existent and supported
7779
}

0 commit comments

Comments
 (0)