Skip to main content

put_blocks

Function put_blocks 

Source
pub fn put_blocks<DbT, SE, TE>(
    wallet_db: &mut DbT,
    gap_limits: GapLimits,
    from_state: &ChainState,
    blocks: Vec<ScannedBlock<<DbT as LowLevelWalletRead>::AccountId>>,
    anchor_retention: Option<&AnchorRetention>,
) -> Result<(), PutBlocksError<SE, TE>>
where DbT: PutBlocksDbT<SE, TE, <DbT as LowLevelWalletRead>::AccountRef>, DbT::TxRef: Eq + Hash,
Expand description

Adds information about a sequence of scanned blocks to the provided data store.

This is equivalent to persisting the row-level data via put_blocks_rows and then updating the note commitment trees with the returned commitments.

§Parameters

  • wallet_db: A handle to the underlying data store.
  • from_state: The note commitment tree state as of the end of the last block prior to the first block in the provided block vector; PutBlocksError::NonSequentialBlocks will be returned if this invariant is violated.
  • blocks: The scanned block data to be added to the data store. This vector must contain data for blocks in sequentially increasing height order; PutBlocksError::NonSequentialBlocks will be returned if this invariant is violated.
  • anchor_retention: If Some(retention), the checkpoints the policy retains — those at or above its floor that fall on its interval — are kept as durable anchors, exempting them from automatic pruning of excess checkpoints. A checkpoint is CREATED at every retained height in the scanned range that would not otherwise receive one: scanning only checkpoints a block at its last note commitment, so a boundary block containing no shielded outputs in any pool would otherwise leave a permanent hole in the retained grid, and the anchor there could never be proved against. None disables anchor retention.