pub fn put_blocks<DbT, P, SE, TE>(
wallet_db: &mut DbT,
params: &P,
gap_limits: GapLimits,
from_state: &ChainState,
blocks: Vec<ScannedBlock<<DbT as LowLevelWalletRead>::AccountId>>,
chain_tip: Option<BlockHeight>,
anchor_retention: Option<&AnchorRetention>,
) -> Result<(), PutBlocksError<SE, TE>>where
DbT: PutBlocksDbT<SE, TE, <DbT as LowLevelWalletRead>::AccountRef>,
DbT::TxRef: Eq + Hash,
P: Parameters,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::NonSequentialBlockswill 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::NonSequentialBlockswill be returned if this invariant is violated.anchor_retention: IfSome(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.Nonedisables anchor retention.chain_tip: The wallet’s view of the chain tip, if known.Checkpointretention is used only withinPRUNING_DEPTHblocks of the later of this height and the last block inblocks: every scanned height inside that window receives a checkpoint in every tree, whether or not a block there carries a commitment, so that an anchor exists at the confirmations-policy depth. A block-end checkpoint below the window is not created, since it would be pruned as soon as the window advanced; its commitment keeps only the marking that protects a wallet note. Retained anchor heights are checkpointed regardless.