mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
fix: check additional settings when enabling discv5 (#16643)
This commit is contained in:
@@ -441,7 +441,7 @@ impl DiscoveryArgs {
|
||||
network_config_builder = network_config_builder.disable_nat();
|
||||
}
|
||||
|
||||
if !self.disable_discovery && self.enable_discv5_discovery {
|
||||
if self.should_enable_discv5() {
|
||||
network_config_builder = network_config_builder
|
||||
.discovery_v5(self.discovery_v5_builder(rlpx_tcp_socket, boot_nodes));
|
||||
}
|
||||
@@ -490,6 +490,17 @@ impl DiscoveryArgs {
|
||||
.bootstrap_lookup_countdown(*discv5_bootstrap_lookup_countdown)
|
||||
}
|
||||
|
||||
/// Returns true if discv5 discovery should be configured
|
||||
const fn should_enable_discv5(&self) -> bool {
|
||||
if self.disable_discovery {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.enable_discv5_discovery ||
|
||||
self.discv5_addr.is_some() ||
|
||||
self.discv5_addr_ipv6.is_some()
|
||||
}
|
||||
|
||||
/// Set the discovery port to zero, to allow the OS to assign a random unused port when
|
||||
/// discovery binds to the socket.
|
||||
pub const fn with_unused_discovery_port(mut self) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user