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

Method network_config

crates/execution/node/src/node.rs:1317–1357  ·  view source on GitHub ↗

Returns the [`NetworkConfig`] that contains the settings to launch the p2p network. This applies the configured [`BaseNetworkBuilder`] settings.

(
        &self,
        ctx: &BuilderContext<Node>,
    )

Source from the content-addressed store, hash-verified

1315 ///
1316 /// This applies the configured [`BaseNetworkBuilder`] settings.
1317 pub fn network_config<Node, NetworkP>(
1318 &self,
1319 ctx: &BuilderContext<Node>,
1320 ) -> eyre::Result<NetworkConfig<Node::Provider, NetworkP>>
1321 where
1322 Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>,
1323 NetworkP: NetworkPrimitives,
1324 {
1325 let disable_txpool_gossip = self.disable_txpool_gossip;
1326 let discovery_config = BaseDiscoveryConfig::new(self.disable_discovery_v4);
1327 let args = &ctx.config().network;
1328 let network_builder = ctx
1329 .network_config_builder()?
1330 // apply discovery settings
1331 .apply(|builder| {
1332 let external_addr = if args.discovery.disable_discovery {
1333 None
1334 } else {
1335 Self::block_on(args.nat.clone().external_addr())
1336 };
1337 discovery_config.apply_to_network_builder(
1338 builder,
1339 args,
1340 ctx.config()
1341 .network
1342 .resolved_bootnodes()
1343 .or_else(|| ctx.chain_spec().bootnodes())
1344 .unwrap_or_default(),
1345 external_addr,
1346 )
1347 });
1348
1349 let mut network_config = ctx.build_network_config(network_builder);
1350
1351 // When `sequencer_endpoint` is configured, the node will forward all transactions to a
1352 // Sequencer node for execution and inclusion on L1, and disable its own txpool
1353 // gossip to prevent other parties in the network from learning about them.
1354 network_config.tx_gossip_disabled = disable_txpool_gossip;
1355
1356 Ok(network_config)
1357 }
1358}
1359
1360impl<Node, Pool> NetworkBuilder<Node, Pool> for BaseNetworkBuilder

Callers 1

build_networkMethod · 0.45

Calls 7

block_onFunction · 0.85
configMethod · 0.45
applyMethod · 0.45
cloneMethod · 0.45
bootnodesMethod · 0.45
chain_specMethod · 0.45

Tested by

no test coverage detected