Skip to main content

fold_ancestors

Function fold_ancestors 

Source
pub fn fold_ancestors(
    stored: &Revision,
    incoming: &[Revision],
    current: Option<&Record>,
    cap: usize,
) -> Vec<Revision>
Expand description

The ancestor list to persist for a record whose revision is stored, replacing current (if any), given the ancestors the writer supplied.

dedup(incoming ∪ {current.revision} ∪ current.ancestors) − {stored}, sorted by (counter desc, hash desc) and truncated to cap. The order is total, so every substrate persists byte-identical lists.