referrerpolicy=no-referrer-when-downgrade

update_tree_leaf

Function update_tree_leaf 

Source
pub fn update_tree_leaf(
    root_entry: &mut Option<TreeRootEntry>,
    stream: StreamId,
    stream_root: Hash,
    store: &mut impl NodeStore,
) -> Result<StreamsRoot, TreeError>
Expand description

Incrementally update or insert a stream into the commitment trie storage.

Updates the path in O(log S) time, reading only nodes along the path from root to leaf and updating inner node sibling caches. Untouched subtrees are neither read nor recomputed.

Returns the new StreamsRoot, or TreeError if an expected inner node is missing from store.