MCPcopy Create free account
hub / github.com/base/base / discovery_driver

Method discovery_driver

crates/consensus/cli/src/bootnode.rs:224–246  ·  view source on GitHub ↗

Builds the discovery driver from the CLI arguments.

(
        &self,
        chain_id: u64,
    )

Source from the content-addressed store, hash-verified

222
223 /// Builds the discovery driver from the CLI arguments.
224 pub fn discovery_driver(
225 &self,
226 chain_id: u64,
227 ) -> eyre::Result<base_consensus_disc::Discv5Driver> {
228 let keypair = self.keypair(chain_id)?;
229 let local_node_key = Self::local_node_key(keypair)?;
230 let advertised = self.advertised_node(local_node_key);
231 let discovery_config = self.discovery_config();
232 let bootstore = self.bootstore(chain_id);
233 let bootnodes = self.bootnodes()?;
234
235 let mut builder = Discv5Builder::new(advertised, chain_id, discovery_config)
236 .with_bootstore_file(bootstore)
237 .with_bootnodes(bootnodes)
238 .with_interval(Duration::from_secs(self.discovery_interval))
239 .disable_forward();
240
241 if let Some(randomize) = self.discovery_randomize {
242 builder = builder.with_discovery_randomize(Some(Duration::from_secs(randomize)));
243 }
244
245 builder.build().map_err(Into::into)
246 }
247
248 /// Builds the local bootnode ENR without starting the discovery service.
249 pub fn local_enr(&self, chain_id: u64) -> eyre::Result<Enr> {

Callers 2

execMethod · 0.80
run_consensusMethod · 0.80

Calls 12

advertised_nodeMethod · 0.80
discovery_configMethod · 0.80
bootstoreMethod · 0.80
disable_forwardMethod · 0.80
with_intervalMethod · 0.80
with_bootstore_fileMethod · 0.80
newFunction · 0.50
keypairMethod · 0.45
bootnodesMethod · 0.45
with_bootnodesMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected