mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 02:48:03 +00:00
expose setting kademlia replication factor through node CLI (#14391)
* expose kademlia replication factor through node CLI * set default CLI flag value for kademlia_replication_factor Co-authored-by: Bastian Köcher <git@kchr.de> * wrap CLI value as Option * make kademlia replication factor non-optional --------- Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -28,7 +28,7 @@ use sc_service::{
|
||||
config::{Multiaddr, MultiaddrWithPeerId},
|
||||
ChainSpec, ChainType,
|
||||
};
|
||||
use std::{borrow::Cow, path::PathBuf};
|
||||
use std::{borrow::Cow, num::NonZeroUsize, path::PathBuf};
|
||||
|
||||
/// Parameters used to create the network configuration.
|
||||
#[derive(Debug, Clone, Args)]
|
||||
@@ -121,6 +121,13 @@ pub struct NetworkParams {
|
||||
#[arg(long)]
|
||||
pub kademlia_disjoint_query_paths: bool,
|
||||
|
||||
/// Kademlia replication factor determines to how many closest peers a record is replicated to.
|
||||
///
|
||||
/// Discovery mechanism requires successful replication to all
|
||||
/// `kademlia_replication_factor` peers to consider record successfully put.
|
||||
#[arg(long, default_value = "20")]
|
||||
pub kademlia_replication_factor: NonZeroUsize,
|
||||
|
||||
/// Join the IPFS network and serve transactions over bitswap protocol.
|
||||
#[arg(long)]
|
||||
pub ipfs_server: bool,
|
||||
@@ -233,6 +240,7 @@ impl NetworkParams {
|
||||
enable_dht_random_walk: !self.reserved_only,
|
||||
allow_non_globals_in_dht,
|
||||
kademlia_disjoint_query_paths: self.kademlia_disjoint_query_paths,
|
||||
kademlia_replication_factor: self.kademlia_replication_factor,
|
||||
yamux_window_size: None,
|
||||
ipfs_server: self.ipfs_server,
|
||||
sync_mode: self.sync.into(),
|
||||
|
||||
Reference in New Issue
Block a user