Returns the [`NetworkConfig`] that contains the settings to launch the p2p network. This applies the configured [`BaseNetworkBuilder`] settings.
(
&self,
ctx: &BuilderContext<Node>,
)
| 1366 | /// |
| 1367 | /// This applies the configured [`BaseNetworkBuilder`] settings. |
| 1368 | pub fn network_config<Node, NetworkP>( |
| 1369 | &self, |
| 1370 | ctx: &BuilderContext<Node>, |
| 1371 | ) -> eyre::Result<NetworkConfig<Node::Provider, NetworkP>> |
| 1372 | where |
| 1373 | Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>, |
| 1374 | NetworkP: NetworkPrimitives, |
| 1375 | { |
| 1376 | let discovery_config = BaseDiscoveryConfig::new(self.disable_discovery_v4); |
| 1377 | let args = &ctx.config().network; |
| 1378 | let network_builder = ctx |
| 1379 | .network_config_builder()? |
| 1380 | // apply discovery settings |
| 1381 | .apply(|builder| { |
| 1382 | let external_addr = if args.discovery.disable_discovery { |
| 1383 | None |
| 1384 | } else { |
| 1385 | Self::block_on(args.nat.clone().external_addr()) |
| 1386 | }; |
| 1387 | discovery_config.apply_to_network_builder( |
| 1388 | builder, |
| 1389 | args, |
| 1390 | ctx.config() |
| 1391 | .network |
| 1392 | .resolved_bootnodes() |
| 1393 | .or_else(|| ctx.chain_spec().bootnodes()) |
| 1394 | .unwrap_or_default(), |
| 1395 | external_addr, |
| 1396 | ) |
| 1397 | }); |
| 1398 | |
| 1399 | let mut network_config = ctx.build_network_config(network_builder); |
| 1400 | |
| 1401 | network_config.tx_gossip_disabled = true; |
| 1402 | |
| 1403 | Ok(network_config) |
| 1404 | } |
| 1405 | } |
| 1406 | |
| 1407 | impl<Node, Pool> NetworkBuilder<Node, Pool> for BaseNetworkBuilder |
no test coverage detected