pub async fn initialize_network<Z, T, PR, CS>(
protocol_request_handler_maker: PR,
core_sync_svc: CS,
config: P2PConfig<Z>,
transport_config: TransportConfig<Z, T>,
) -> Result<NetworkInterface<Z>, BoxError>where
Z: NetworkZone,
T: Transport<Z>,
Z::Addr: BorshDeserialize + BorshSerialize,
PR: ProtocolRequestHandlerMaker<Z> + Clone,
CS: CoreSyncSvc + Clone,
Expand description
Initializes the P2P NetworkInterface
for a specific NetworkZone
.
This function starts all the tasks to maintain/accept/make connections.
§Usage
You must provide:
- A protocol request handler, which is given to each connection
- A core sync service, which keeps track of the sync state of our node