Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5912 only static peers #7447

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Nethermind/Nethermind.Network/Config/INetworkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ public interface INetworkConfig : IConfig

[ConfigItem(DefaultValue = "false", HiddenFromDocs = true, Description = "[TECHNICAL] Disable feeding ENR DNS records to discv4 table")]
bool DisableDiscV4DnsFeeder { get; set; }

[ConfigItem(Description = "Whether to enable the node discovery. If disabled, Nethermind doesn't look for other nodes beyond the specified nodes.", DefaultValue = "true")]
bool DiscoveryEnabled { get; set; }
}
5 changes: 5 additions & 0 deletions src/Nethermind/Nethermind.Network/Config/NetworkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class NetworkConfig : INetworkConfig
public string? DiscoveryDns { get; set; }

public bool OnlyStaticPeers { get; set; }

public bool IsPeersPersistenceOn { get; set; } = true;

[Obsolete]
Expand Down Expand Up @@ -40,5 +41,9 @@ public class NetworkConfig : INetworkConfig
public int ProcessingThreadCount { get; set; } = 1;
public string? ClientIdMatcher { get; set; } = null;
public bool DisableDiscV4DnsFeeder { get; set; } = false;
public bool DiscoveryEnabled {
get { return DiscoveryEnabled; }
set { if (OnlyStaticPeers == true) value = false; else value = true; }
}
}
}
3 changes: 3 additions & 0 deletions src/Nethermind/Nethermind.Network/PeerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ private void ProcessIncomingConnection(ISession session)
// TODO: here the session.Node may not be equal peer.Node -> would be good to check if we can improve it
session.Node.IsStatic = existingPeer.Node.IsStatic;
}
if (!_networkConfig.DiscoveryEnabled && !session.Node.IsStatic) {
return;
}

if (_logger.IsTrace) _logger.Trace($"INCOMING {session}");

Expand Down