Skip to main content

scan_cached_blocks

Function scan_cached_blocks 

Source
pub fn scan_cached_blocks<ParamsT, DbT, BlockSourceT>(
    params: &ParamsT,
    block_source: &BlockSourceT,
    data_db: &mut DbT,
    from_height: BlockHeight,
    from_state: &ChainState,
    limit: usize,
) -> Result<ScanSummary, Error<<DbT as WalletRead>::Error, BlockSourceT::Error>>
where ParamsT: Parameters + Send + 'static, BlockSourceT: BlockSource, DbT: WalletWrite, <DbT as WalletRead>::AccountId: ConditionallySelectable + Default + Send + Sync + 'static,
Expand description

Scans at most limit blocks from the provided block source in order to find transactions received by the accounts tracked in the provided wallet database.

This function will return after scanning at most limit new blocks, to enable the caller to update their UI with scanning progress.

§Errors

  • Error::BlockSource if the requested blocks cannot be read from block_source.
  • Error::Scan if a scanned block violates chain-continuity rules, or if the scanned note commitment data (or from_state) conflicts with the wallet’s note commitment tree(s). The latter is reported by WalletWrite::put_blocks as PutBlocksError::Continuity and is a continuity error at the first block of the batch.
  • Error::Wallet if a wallet-database operation fails. This covers reading the tracked viewing keys, block metadata, and nullifiers, as well as persisting the scanned blocks via WalletWrite::put_blocks.

§Panics

This method will panic if from_height != from_state.block_height() + 1.