Skip to main content

process_iter

Function process_iter 

Source
pub fn process_iter<P, B, BB, BH>(
    iter: impl Iterator<Item = Result<(BH, BB, Option<Vec<<<P as NodePrimitivesProvider>::Primitives as NodePrimitives>::Receipt>>)>>,
    writer: &mut StaticFileProviderRWRefMut<'_, <P as NodePrimitivesProvider>::Primitives>,
    receipts_writer: Option<&mut StaticFileProviderRWRefMut<'_, <P as NodePrimitivesProvider>::Primitives>>,
    provider: &P,
    hash_collector: &mut Collector<BlockHash, BlockNumber>,
    block_numbers: impl RangeBounds<BlockNumber>,
    policy: ImportPolicy<'_>,
) -> Result<BlockNumber>
where B: Block<Header = BH, Body = BB>, BH: FullBlockHeader + Value, BB: FullBlockBody<Transaction = <<P as NodePrimitivesProvider>::Primitives as NodePrimitives>::SignedTx, OmmerHeader = BH>, P: DBProvider<Tx: DbTxMut> + NodePrimitivesProvider + BlockWriter<Block = B> + BlockBodyIndicesProvider + BlockHashReader, <P as NodePrimitivesProvider>::Primitives: NodePrimitives<BlockHeader = BH, BlockBody = BB>, <<P as NodePrimitivesProvider>::Primitives as NodePrimitives>::Receipt: Compact + Receipt,
Expand description

Extracts block headers, bodies and (optionally) receipts from iter and appends them using writer, receipts_writer and provider.

Collects hash to height using hash_collector.

Skips all blocks below the start_bound of block_numbers and stops when reaching past the end_bound or the end of the file.

Blocks at or below headers_tip only have their receipts backfilled; blocks above it get header, body and receipts written.

When receipts_writer is Some, every block must carry receipts, a block without them, possible for .ere files, whose receipts are optional per spec is an error. Receipts are checked against the header’s logs bloom, and against its receipts root when is_receipt_verifiable returns true.

Returns last block height.