Trait mina_consensus::common::ChainSelection
source · [−]pub trait ChainSelection {
fn select_secure_chain(
&mut self,
candidates: Vec<Self>
) -> Result<(), ConsensusError>
where
Self: Sized;
fn select_longer_chain(
&mut self,
candidate: Self
) -> Result<(), ConsensusError>
where
Self: Sized;
fn is_short_range(&self, candidate: &Self) -> Result<bool, ConsensusError>;
fn relative_min_window_density(
&self,
candidate: &Self
) -> Result<u32, ConsensusError>;
fn config(&self) -> ConsensusConstants;
}
Expand description
A trait that defines operations for chain selection
Required Methods
sourcefn select_secure_chain(
&mut self,
candidates: Vec<Self>
) -> Result<(), ConsensusError>where
Self: Sized,
fn select_secure_chain(
&mut self,
candidates: Vec<Self>
) -> Result<(), ConsensusError>where
Self: Sized,
Top level API to select between chains during a fork.
sourcefn select_longer_chain(&mut self, candidate: Self) -> Result<(), ConsensusError>where
Self: Sized,
fn select_longer_chain(&mut self, candidate: Self) -> Result<(), ConsensusError>where
Self: Sized,
Selects the longer chain when there’s a short range fork.
sourcefn is_short_range(&self, candidate: &Self) -> Result<bool, ConsensusError>
fn is_short_range(&self, candidate: &Self) -> Result<bool, ConsensusError>
Checks whether the fork is short range wrt to candidate chain
sourcefn relative_min_window_density(
&self,
candidate: &Self
) -> Result<u32, ConsensusError>
fn relative_min_window_density(
&self,
candidate: &Self
) -> Result<u32, ConsensusError>
Calculates the relate minimum window density wrt to candidate chain.
sourcefn config(&self) -> ConsensusConstants
fn config(&self) -> ConsensusConstants
Constants used for consensus