pub fn import<S, Downloader, Era, PF, B, BB, BH>(
downloader: Downloader,
provider_factory: &PF,
hash_collector: &mut Collector<BlockHash, BlockNumber>,
to_block: Option<BlockNumber>,
store_receipts: bool,
is_receipt_verifiable: &dyn Fn(BlockNumber) -> bool,
) -> Result<BlockNumber>where
S: EraBlockReader<BH, BB, <<<PF as DatabaseProviderFactory>::ProviderRW as NodePrimitivesProvider>::Primitives as NodePrimitives>::Receipt>,
B: Block<Header = BH, Body = BB>,
BH: FullBlockHeader + Value,
BB: FullBlockBody<Transaction = <<<PF as DatabaseProviderFactory>::ProviderRW as NodePrimitivesProvider>::Primitives as NodePrimitives>::SignedTx, OmmerHeader = BH>,
Downloader: Stream<Item = Result<Era>> + Send + 'static + Unpin,
Era: EraMeta + Send + 'static,
PF: DatabaseProviderFactory<ProviderRW: BlockWriter<Block = B> + DBProvider + BlockBodyIndicesProvider + BlockHashReader + StaticFileProviderFactory<Primitives: NodePrimitives<Block = B, BlockHeader = BH, BlockBody = BB>> + StageCheckpointReader + StageCheckpointWriter + StorageSettingsCache> + StaticFileProviderFactory<Primitives = <<PF as DatabaseProviderFactory>::ProviderRW as NodePrimitivesProvider>::Primitives>,
<<<PF as DatabaseProviderFactory>::ProviderRW as NodePrimitivesProvider>::Primitives as NodePrimitives>::Receipt: Compact + Receipt,Expand description
Imports blocks from downloader, decoding each file with the EraBlockReader S.
When to_block is set, the import stops after reaching that block height; otherwise it
continues until the source has no more files.
store_receipts backfills the Receipts segment from its tip up to the Execution
checkpoint, which it must reach exactly: receipts above the checkpoint are pruned on the next
node start, and receipts below it leave the node unable to start. Only a missing tail is
detected, never a gap inside the existing segment.
is_receipt_verifiable decides which blocks have their receipts checked against the header,
as pre-Byzantium receipts can’t be recomputed here.
Returns current block height.