mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(cli): add --disable-discovery (#597)
* redo add disable_discovery cli flag * incorporate option into discovery test * smol touch up * rustmft Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -27,6 +27,7 @@ impl Config {
|
||||
db: Arc<DB>,
|
||||
chain_id: u64,
|
||||
genesis_hash: H256,
|
||||
disable_discovery: bool,
|
||||
) -> NetworkConfig<ProviderImpl<DB>> {
|
||||
let peer_config = reth_network::PeersConfig::default()
|
||||
.with_trusted_nodes(self.peers.trusted_nodes.clone())
|
||||
@ -36,6 +37,7 @@ impl Config {
|
||||
.peer_config(peer_config)
|
||||
.genesis_hash(genesis_hash)
|
||||
.chain_id(chain_id)
|
||||
.set_discovery(disable_discovery)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,6 +75,10 @@ pub struct Command {
|
||||
/// NOTE: This is a temporary flag
|
||||
#[arg(long = "debug.tip")]
|
||||
tip: Option<H256>,
|
||||
|
||||
/// Disable the discovery service.
|
||||
#[arg(short, long)]
|
||||
disable_discovery: bool,
|
||||
}
|
||||
|
||||
impl Command {
|
||||
@ -98,8 +102,10 @@ impl Command {
|
||||
let consensus = Arc::new(BeaconConsensus::new(self.chain.consensus.clone()));
|
||||
let genesis_hash = init_genesis(db.clone(), self.chain.genesis.clone())?;
|
||||
|
||||
let network =
|
||||
config.network_config(db.clone(), chain_id, genesis_hash).start_network().await?;
|
||||
let network = config
|
||||
.network_config(db.clone(), chain_id, genesis_hash, self.disable_discovery)
|
||||
.start_network()
|
||||
.await?;
|
||||
|
||||
info!(peer_id = ?network.peer_id(), local_addr = %network.local_addr(), "Started p2p networking");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user