fix(cmd): fix disabling discovery through config file #33279 (#2003)

This commit is contained in:
Daniel Liu 2026-02-10 19:19:55 +08:00 committed by GitHub
parent b95923e25c
commit 4f7159b119
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -681,9 +681,11 @@ var (
Category: flags.NetworkingCategory,
}
DiscoveryV5Flag = &cli.BoolFlag{
Name: "v5disc",
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
Name: "discovery-v5",
Aliases: []string{"discv5"},
Usage: "Enables the V5 discovery mechanism",
Category: flags.NetworkingCategory,
Value: node.DefaultConfig.P2P.DiscoveryV5,
}
NetrestrictFlag = &cli.StringFlag{
Name: "netrestrict",
@ -1296,7 +1298,9 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
}
flags.CheckExclusive(ctx, DiscoveryV5Flag, NoDiscoverFlag)
cfg.DiscoveryV5 = ctx.Bool(DiscoveryV5Flag.Name)
if ctx.IsSet(DiscoveryV5Flag.Name) {
cfg.DiscoveryV5 = ctx.Bool(DiscoveryV5Flag.Name)
}
if netrestrict := ctx.String(NetrestrictFlag.Name); netrestrict != "" {
list, err := netutil.ParseNetlist(netrestrict)

View file

@ -67,9 +67,10 @@ var DefaultConfig = Config{
BatchRequestLimit: 1000,
BatchResponseMaxSize: 25 * 1000 * 1000,
P2P: p2p.Config{
ListenAddr: ":30303",
MaxPeers: 50,
NAT: nat.Any(),
ListenAddr: ":30303",
MaxPeers: 50,
NAT: nat.Any(),
DiscoveryV5: true,
},
}