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

Method network_config

crates/execution/node/src/node.rs:1240–1280  ·  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

1238 ///
1239 /// This applies the configured [`BaseNetworkBuilder`] settings.
1240 pub fn network_config<Node, NetworkP>(
1241 &self,
1242 ctx: &BuilderContext<Node>,
1243 ) -> eyre::Result<NetworkConfig<Node::Provider, NetworkP>>
1244 where
1245 Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>,
1246 NetworkP: NetworkPrimitives,
1247 {
1248 let disable_txpool_gossip = self.disable_txpool_gossip;
1249 let discovery_config = BaseDiscoveryConfig::new(self.disable_discovery_v4);
1250 let args = &ctx.config().network;
1251 let network_builder = ctx
1252 .network_config_builder()?
1253 // apply discovery settings
1254 .apply(|builder| {
1255 let external_addr = if args.discovery.disable_discovery {
1256 None
1257 } else {
1258 Self::block_on(args.nat.clone().external_addr())
1259 };
1260 discovery_config.apply_to_network_builder(
1261 builder,
1262 args,
1263 ctx.config()
1264 .network
1265 .resolved_bootnodes()
1266 .or_else(|| ctx.chain_spec().bootnodes())
1267 .unwrap_or_default(),
1268 external_addr,
1269 )
1270 });
1271
1272 let mut network_config = ctx.build_network_config(network_builder);
1273
1274 // When `sequencer_endpoint` is configured, the node will forward all transactions to a
1275 // Sequencer node for execution and inclusion on L1, and disable its own txpool
1276 // gossip to prevent other parties in the network from learning about them.
1277 network_config.tx_gossip_disabled = disable_txpool_gossip;
1278
1279 Ok(network_config)
1280 }
1281}
1282
1283impl<Node, Pool> NetworkBuilder<Node, Pool> for BaseNetworkBuilder

Callers 1

build_networkMethod · 0.80

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