Fix #19820 - reduce light.maxpeers default for clients to 1/10th

currently light.maxpeers=100 - after this change it's 10 for non-servers
This commit is contained in:
Sjon Hortensius 2019-08-09 15:06:47 +02:00
parent c9cdf144d5
commit ca8ba84aa7

View file

@ -1091,6 +1091,11 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name)
} }
if lightClient && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
// dynamic default - for clients we use 1/10th of the default for servers
lightPeers /= 10
}
if ctx.GlobalIsSet(MaxPeersFlag.Name) { if ctx.GlobalIsSet(MaxPeersFlag.Name) {
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name) cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {