mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: also set configured bootnodes for discv5 (#9885)
This commit is contained in:
@ -385,12 +385,17 @@ impl NetworkConfigBuilder {
|
||||
self.boot_nodes(sepolia_nodes())
|
||||
}
|
||||
|
||||
/// Sets the boot nodes.
|
||||
/// Sets the boot nodes to use to bootstrap the configured discovery services (discv4 + discv5).
|
||||
pub fn boot_nodes<T: Into<TrustedPeer>>(mut self, nodes: impl IntoIterator<Item = T>) -> Self {
|
||||
self.boot_nodes = nodes.into_iter().map(Into::into).collect();
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns an iterator over all configured boot nodes.
|
||||
pub fn boot_nodes_iter(&self) -> impl Iterator<Item = &TrustedPeer> + '_ {
|
||||
self.boot_nodes.iter()
|
||||
}
|
||||
|
||||
/// Disable the DNS discovery.
|
||||
pub fn disable_dns_discovery(mut self) -> Self {
|
||||
self.dns_discovery_config = None;
|
||||
|
||||
@ -173,7 +173,7 @@ impl NetworkManager {
|
||||
secret_key,
|
||||
discovery_v4_addr,
|
||||
mut discovery_v4_config,
|
||||
discovery_v5_config,
|
||||
mut discovery_v5_config,
|
||||
listener_addr,
|
||||
peers_config,
|
||||
sessions_config,
|
||||
@ -208,12 +208,16 @@ impl NetworkManager {
|
||||
resolved_boot_nodes.push(resolved);
|
||||
}
|
||||
|
||||
discovery_v4_config = discovery_v4_config.map(|mut disc_config| {
|
||||
if let Some(disc_config) = discovery_v4_config.as_mut() {
|
||||
// merge configured boot nodes
|
||||
disc_config.bootstrap_nodes.extend(resolved_boot_nodes.clone());
|
||||
disc_config.add_eip868_pair("eth", status.forkid);
|
||||
disc_config
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(discv5) = discovery_v5_config.as_mut() {
|
||||
// merge configured boot nodes
|
||||
discv5.extend_unsigned_boot_nodes(resolved_boot_nodes)
|
||||
}
|
||||
|
||||
let discovery = Discovery::new(
|
||||
listener_addr,
|
||||
|
||||
Reference in New Issue
Block a user