pub struct Versionbits<'a> { /* private fields */ }
Expand description

Struct Implements versionbits threshold logic, and caches results.

Implementations§

source§

impl<'a> Versionbits<'a>

source

pub fn new(id: DeploymentPos, consensus: &'a Consensus) -> Self

construct new Versionbits wrapper

source

pub fn mask(&self) -> u32

return bit mask corresponding deployment

Trait Implementations§

source§

impl<'a> VersionbitsConditionChecker for Versionbits<'a>

source§

fn start(&self) -> EpochNumber

Specifies the first epoch in which the bit gains meaning.
source§

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

The period for signal statistics are counted
source§

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
source§

fn min_activation_epoch(&self) -> EpochNumber

Specifies the epoch at which the softfork is allowed to become active.
source§

fn active_mode(&self) -> ActiveMode

Active mode for testing.
source§

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: &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.
source§

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

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for Twhere T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

TODO(doc): @quake
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V