Skip to main content

download_blocks

Function download_blocks 

Source
pub fn download_blocks<N: NetworkZone, C>(
    peer_set: BoxCloneService<PeerSetRequest, PeerSetResponse<N>, BoxError>,
    our_chain_svc: C,
    config: BlockDownloaderConfig,
) -> BlockDownloaderHandle
where C: Service<ChainSvcRequest<N>, Response = ChainSvcResponse<N>, Error = BoxError> + Send + 'static, C::Future: Send + 'static,
Expand description

This function starts the block downloader and returns a BlockDownloaderHandle.

The block downloader will pick the longest chain and will follow it for as long as possible, the blocks given from the [BufferStream] will be in order.

The downloader runs until it is aborted with the returned [JoinHandle].

The block downloader may fail before the whole chain is downloaded. If this is the case you can call this function again, so it can start the search again.