zebra_state::service::finalized_state::disk_format::upgrade::add_subtrees

Function calculate_sapling_subtree

source
fn calculate_sapling_subtree(
    read_db: &ZebraDb,
    prev_end_height: Height,
    prev_tree: Arc<NoteCommitmentTree>,
    end_height: Height,
    tree: Arc<NoteCommitmentTree>,
) -> NoteCommitmentSubtree<Node>
Expand description

Calculates a note commitment subtree for Sapling, reading blocks from read_db if needed.

The subtree must be completed by a note commitment in the block at end_height. tree is the tree for that block, and prev_tree is the tree for the previous block.

prev_tree is only used to rebuild the subtree if it was completed without using the last note commitment in the block at end_height.

ยงPanics

If a subtree is not completed by a note commitment in the block at end_height.