pub struct Versionbits<'a> { /* private fields */ }
Expand description
Struct Implements versionbits threshold logic, and caches results.
Implementations§
Source§impl<'a> Versionbits<'a>
impl<'a> Versionbits<'a>
Trait Implementations§
Source§impl<'a> VersionbitsConditionChecker for Versionbits<'a>
impl<'a> VersionbitsConditionChecker for Versionbits<'a>
Source§fn start(&self) -> EpochNumber
fn start(&self) -> EpochNumber
Specifies the first epoch in which the bit gains meaning.
Source§fn 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.
Source§fn period(&self) -> EpochNumber
fn period(&self) -> EpochNumber
The period for signal statistics are counted
Source§fn 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 signalSource§fn min_activation_epoch(&self) -> EpochNumber
fn min_activation_epoch(&self) -> EpochNumber
Specifies the epoch at which the softfork is allowed to become active.
Source§fn active_mode(&self) -> ActiveMode
fn active_mode(&self) -> ActiveMode
Active mode for testing.
Source§fn threshold(&self) -> Ratio
fn threshold(&self) -> Ratio
Specifies the minimum ratio of block per epoch,
which indicate the locked_in of the softfork during the epoch.
Source§fn get_state<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Cache,
indexer: &I,
) -> Option<ThresholdState>
fn get_state<I: VersionbitsIndexer>( &self, header: &HeaderView, cache: &Cache, 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.
Source§fn get_state_since_epoch<I: VersionbitsIndexer>(
&self,
header: &HeaderView,
cache: &Cache,
indexer: &I,
) -> Option<EpochNumber>
fn get_state_since_epoch<I: VersionbitsIndexer>( &self, header: &HeaderView, cache: &Cache, indexer: &I, ) -> Option<EpochNumber>
Returns the first epoch which the state applies
Auto Trait Implementations§
impl<'a> Freeze for Versionbits<'a>
impl<'a> RefUnwindSafe for Versionbits<'a>
impl<'a> Send for Versionbits<'a>
impl<'a> Sync for Versionbits<'a>
impl<'a> Unpin for Versionbits<'a>
impl<'a> UnwindSafe for Versionbits<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more