pub async fn initialize_network<N, PR, CS>(
protocol_request_handler_maker: PR,
core_sync_svc: CS,
config: P2PConfig<N>,
) -> Result<NetworkInterface<N>, BoxError>where
N: NetworkZone,
N::Addr: BorshDeserialize + BorshSerialize,
PR: ProtocolRequestHandlerMaker<N> + 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