referrerpolicy=no-referrer-when-downgrade

request_bitswap_blocks

Function request_bitswap_blocks 

Source
pub async fn request_bitswap_blocks<N>(
    network: &N,
    peer: PeerId,
    cids: &[Cid],
) -> Result<HashMap<Cid, FetchOutcome>, BitswapError>
where N: NetworkRequest + ?Sized,
Expand description

Send one WANT-BLOCK request for cids to peer and classify the response.

Returned blocks are verified by recomputing the CID from the response prefix and bytes. Blocks whose recomputed CID was not requested are ignored.

Errors if cids is empty, larger than MAX_WANTED_BLOCKS, contains an unsupported CID, or contains a duplicate CID.

Note: This is a temporary API that shall be superseeded by a better abstraction such as https://github.com/paritytech/polkadot-sdk/issues/12052