Skip to main content

ensure_checkpoints

Function ensure_checkpoints 

Source
pub fn ensure_checkpoints<'a, H, I: Iterator<Item = &'a BlockHeight>, const DEPTH: u8>(
    ensure_heights: I,
    created_checkpoints: &BTreeSet<BlockHeight>,
    block_end_positions: &BTreeMap<BlockHeight, Position>,
    state_final_tree: &Frontier<H, DEPTH>,
) -> Vec<(BlockHeight, Checkpoint)>
Expand description

Produces the checkpoints that must be added to a pool’s note commitment tree so that it gains a checkpoint at each of the requested heights. A height in created_checkpoints is skipped, since inserting the batch’s subtrees creates its checkpoint. Any other height receives a checkpoint at the position recorded in block_end_positions for the nearest block at or below it that carries a commitment, or at the provided frontier’s position when no such block precedes it in the batch.