Skip to main content

solana_program_runtime/program_cache/
fork_graph.rs

1use solana_clock::Slot;
2
3/// Relationship between two fork IDs
4#[derive(Copy, Clone, Debug, PartialEq)]
5pub enum BlockRelation {
6    /// The slot is on the same fork and is an ancestor of the other slot
7    Ancestor,
8    /// The two slots are equal and are on the same fork
9    Equal,
10    /// The slot is on the same fork and is a descendant of the other slot
11    Descendant,
12    /// The slots are on two different forks and may have had a common ancestor at some point
13    Unrelated,
14    /// Either one or both of the slots are either older than the latest root, or are in future
15    Unknown,
16}
17
18/// Maps relationship between two slots.
19pub trait ForkGraph {
20    /// Returns the BlockRelation of A to B
21    fn relationship(&self, a: Slot, b: Slot) -> BlockRelation;
22}