Returns the [`NetworkConfig`] that contains the settings to launch the p2p network. This applies the configured [`BaseNetworkBuilder`] settings.
(
&self,
ctx: &BuilderContext<Node>,
)
| 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 | |
| 1360 | impl<Node, Pool> NetworkBuilder<Node, Pool> for BaseNetworkBuilder |
no test coverage detected