Skip to content
Merged
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
17 changes: 16 additions & 1 deletion crates/node/core/src/args/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,29 @@ impl NetworkArgs {
///
/// The `default_peers_file` will be used as the default location to store the persistent peers
/// file if `no_persist_peers` is false, and there is no provided `peers_file`.
///
/// Configured Bootnodes are prioritized, if unset, the chain spec bootnodes are used
/// Priority order for bootnodes configuration:
/// 1. --bootnodes flag
/// 2. Network preset flags (e.g. --holesky)
/// 3. default to mainnet nodes
pub fn network_config(
&self,
config: &Config,
chain_spec: Arc<ChainSpec>,
secret_key: SecretKey,
default_peers_file: PathBuf,
) -> NetworkConfigBuilder {
let chain_bootnodes = chain_spec.bootnodes().unwrap_or_else(mainnet_nodes);
let chain_bootnodes = self
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let chain_bootnodes = self
let mut chain_bootnodes = chain_spec.bootnodes().unwrap_or_default();

always add the default bootnodes, otherwise we need a new cli arg flag --no-default-bootnodes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, this change would require --no-default-bootnodes
imo --bootnodes should override default bootnodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update @emhane

.bootnodes
.clone()
.map(|bootnodes| {
bootnodes
.into_iter()
.filter_map(|trusted_peer| trusted_peer.resolve_blocking().ok())
.collect()
})
.unwrap_or_else(|| chain_spec.bootnodes().unwrap_or_else(mainnet_nodes));
let peers_file = self.peers_file.clone().unwrap_or(default_peers_file);

// Configure peer connections
Expand Down