pub trait VersionbitsConditionChecker {
// Required methods
fn start(&self) -> EpochNumber;
fn timeout(&self) -> EpochNumber;
fn active_mode(&self) -> ActiveMode;
fn condition<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
indexer: &I
) -> bool;
fn min_activation_epoch(&self) -> EpochNumber;
fn period(&self) -> EpochNumber;
fn threshold(&self) -> Ratio;
// Provided methods
fn get_state<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Mutex<HashMap<Byte32, ThresholdState>>,
indexer: &I
) -> Option<ThresholdState> { ... }
fn get_state_since_epoch<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Mutex<HashMap<Byte32, ThresholdState>>,
indexer: &I
) -> Option<EpochNumber> { ... }
}
Expand description
Trait that implements versionbits threshold logic, and caches results.
Required Methods§
sourcefn start(&self) -> EpochNumber
fn start(&self) -> EpochNumber
Specifies the first epoch in which the bit gains meaning.
sourcefn timeout(&self) -> EpochNumber
fn timeout(&self) -> EpochNumber
Specifies an epoch at which the miner signaling ends. Once this epoch has been reached, if the softfork has not yet locked_in (excluding this epoch block’s bit state), the deployment is considered failed on all descendants of the block.
sourcefn active_mode(&self) -> ActiveMode
fn active_mode(&self) -> ActiveMode
Active mode for testing.
sourcefn condition<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
indexer: &I
) -> bool
fn condition<I: VersionbitsIndexer>( &self, header: &HeaderView, indexer: &I ) -> bool
Determines whether bit in the version
field of the block is to be used to signal
sourcefn min_activation_epoch(&self) -> EpochNumber
fn min_activation_epoch(&self) -> EpochNumber
Specifies the epoch at which the softfork is allowed to become active.
sourcefn period(&self) -> EpochNumber
fn period(&self) -> EpochNumber
The period for signal statistics are counted
Provided Methods§
sourcefn get_state<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Mutex<HashMap<Byte32, ThresholdState>>,
indexer: &I
) -> Option<ThresholdState>
fn get_state<I: VersionbitsIndexer>( &self, header: &HeaderView, cache: &Mutex<HashMap<Byte32, ThresholdState>>, indexer: &I ) -> Option<ThresholdState>
Returns the state for a header. Applies any state transition if conditions are present. Caches state from first block of period.
sourcefn get_state_since_epoch<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Mutex<HashMap<Byte32, ThresholdState>>,
indexer: &I
) -> Option<EpochNumber>
fn get_state_since_epoch<I: VersionbitsIndexer>( &self, header: &HeaderView, cache: &Mutex<HashMap<Byte32, ThresholdState>>, indexer: &I ) -> Option<EpochNumber>
Returns the first epoch which the state applies