mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: Add testnet chainspec
This commit is contained in:
@ -50,6 +50,7 @@ pub async fn start_pseudo_peer(
|
||||
|
||||
// Create network manager
|
||||
let (mut network, start_tx) = create_network_manager::<BlockSourceBoxed>(
|
||||
(*chain_spec).clone(),
|
||||
destination_peer,
|
||||
block_source.clone(),
|
||||
blockhash_cache.clone(),
|
||||
|
||||
@ -19,6 +19,7 @@ pub struct NetworkBuilder {
|
||||
boot_nodes: Vec<TrustedPeer>,
|
||||
discovery_port: u16,
|
||||
listener_port: u16,
|
||||
chain_spec: HlChainSpec,
|
||||
}
|
||||
|
||||
impl Default for NetworkBuilder {
|
||||
@ -29,6 +30,7 @@ impl Default for NetworkBuilder {
|
||||
boot_nodes: vec![],
|
||||
discovery_port: 0,
|
||||
listener_port: 0,
|
||||
chain_spec: HlChainSpec::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,6 +57,11 @@ impl NetworkBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_chain_spec(mut self, chain_spec: HlChainSpec) -> Self {
|
||||
self.chain_spec = chain_spec;
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn build<BS>(
|
||||
self,
|
||||
block_source: Arc<Box<dyn super::sources::BlockSource>>,
|
||||
@ -80,12 +87,14 @@ impl NetworkBuilder {
|
||||
}
|
||||
|
||||
pub async fn create_network_manager<BS>(
|
||||
chain_spec: HlChainSpec,
|
||||
destination_peer: String,
|
||||
block_source: Arc<Box<dyn super::sources::BlockSource>>,
|
||||
blockhash_cache: BlockHashCache,
|
||||
) -> eyre::Result<(NetworkManager<HlNetworkPrimitives>, mpsc::Sender<()>)> {
|
||||
NetworkBuilder::default()
|
||||
.with_boot_nodes(vec![TrustedPeer::from_str(&destination_peer).unwrap()])
|
||||
.with_chain_spec(chain_spec)
|
||||
.build::<BS>(block_source, blockhash_cache)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user