Skip to content

Commit 1611815

Browse files
SjonHortensiusfjl
authored andcommitted
cmd/utils: reduce light.maxpeers default for clients to 1/10th (#19933)
Currently light.maxpeers is 100 - after this change it's 10 for non-servers. Fixes #19820
1 parent b8a9457 commit 1611815

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/utils/flags.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,11 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
11091109
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
11101110
lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name)
11111111
}
1112+
if lightClient && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
1113+
// dynamic default - for clients we use 1/10th of the default for servers
1114+
lightPeers /= 10
1115+
}
1116+
11121117
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
11131118
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
11141119
if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {

0 commit comments

Comments
 (0)