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 contains note commitments that cannot be reconciled with the wallet’s note commitment tree(s).
  • 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. In particular, a failure to update the note commitment trees with the scanned data is reported here (for example, the zcash_client_sqlite backend surfaces such a failure as a PutBlocksCommitmentTree error identifying the affected shielded pool and block range).

§Panics

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