Skip to main content

update_tree

Function update_tree 

Source
pub fn update_tree<S, const DEPTH: u8, const SHARD_HEIGHT: u8>(
    protocol: &'static str,
    frontier: &Frontier<S::H, DEPTH>,
    frontier_height: BlockHeight,
    tree: &mut ShardTree<S, DEPTH, SHARD_HEIGHT>,
    anchor_retention: Option<&AnchorRetention>,
    subtrees: impl Iterator<Item = (LocatedPrunableTree<S::H>, BTreeMap<BlockHeight, Position>)>,
    missing_checkpoints: impl Iterator<Item = (BlockHeight, Checkpoint)>,
) -> Result<(), ShardTreeError<S::Error>>
where S: ShardStore<CheckpointId = BlockHeight>, S::H: Clone + PartialEq + Hashable,
Expand description

Updates the given note commitment tree with all newly read note commitments starting at the block frontier_height + 1.

If anchor_retention is Some, every checkpoint the policy retains is kept as a durable anchor.

This is generic over the [ShardStore] backing the tree, so stores that maintain their note commitment trees by other means (for example, accumulating updates in memory and flushing them in bulk) can reuse the exact tree-update logic that put_blocks applies.