mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
Fix: fix the issue of not being able to specify bootnode through command parameters (#9237)
This commit is contained in:
@ -123,6 +123,12 @@ impl NetworkArgs {
|
|||||||
///
|
///
|
||||||
/// The `default_peers_file` will be used as the default location to store the persistent peers
|
/// 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`.
|
/// 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(
|
pub fn network_config(
|
||||||
&self,
|
&self,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
@ -130,7 +136,16 @@ impl NetworkArgs {
|
|||||||
secret_key: SecretKey,
|
secret_key: SecretKey,
|
||||||
default_peers_file: PathBuf,
|
default_peers_file: PathBuf,
|
||||||
) -> NetworkConfigBuilder {
|
) -> NetworkConfigBuilder {
|
||||||
let chain_bootnodes = chain_spec.bootnodes().unwrap_or_else(mainnet_nodes);
|
let chain_bootnodes = self
|
||||||
|
.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);
|
let peers_file = self.peers_file.clone().unwrap_or(default_peers_file);
|
||||||
|
|
||||||
// Configure peer connections
|
// Configure peer connections
|
||||||
|
|||||||
Reference in New Issue
Block a user