Skip to main content

best_relevant_chain_and_history_tree

Function best_relevant_chain_and_history_tree 

Source
fn best_relevant_chain_and_history_tree(
    non_finalized_state: &NonFinalizedState,
    db: &ZebraDb,
    network: &Network,
) -> Result<(Height, Hash, Vec<(CompactDifficulty, DateTime<Utc>)>, Arc<HistoryTree>), BoxError>
Expand description

Do a consistency check by checking the finalized tip before and after all other database queries.

Returns the best chain tip, recent header difficulties and times in reverse height order, and the tip history tree. Returns an error if the tip obtained before and after is not the same.

§Panics

  • If we don’t have enough blocks in the state.