Skip to main content

consensus

Function consensus 

Source
pub fn consensus(
    references: &[Run],
    suspect: &Run,
    cost_model: &impl CostModel,
    params: &DiffParams,
) -> Result<Consensus, ParamError>
Expand description

Diff suspect against every run in references and tally where they say it forked.

Tie-break is the lowest step index, which is not arbitrary: it matches the fork rule’s own bias (first non-sync block that never re-syncs) and points at the earliest plausible origin, and — unlike “first one seen” — it makes the answer independent of the order the references were passed in.

§Errors

The first ParamError any reference produces, references taken in order. A run over the size guard is a configuration fact about that run, not a vote to be silently dropped.