Function cuprate_p2p::initialize_network

source ·
pub async fn initialize_network<N, PR, CS>(
    protocol_request_handler: PR,
    core_sync_svc: CS,
    config: P2PConfig<N>,
) -> Result<NetworkInterface<N>, BoxError>
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