pub struct HardForkState {
pub current_hardfork: HardFork,
pub config: HardForkConfig,
pub votes: HFVotes,
pub last_height: usize,
}Expand description
A struct that keeps track of the current hard-fork and current votes.
Fields§
§current_hardfork: HardForkThe current active hard-fork.
config: HardForkConfigThe hard-fork config.
votes: HFVotesThe votes in the current window.
last_height: usizeThe last block height accounted for.
Implementations§
Source§impl HardForkState
impl HardForkState
Sourcepub async fn init_from_chain_height<D: Database + Clone>(
chain_height: usize,
config: HardForkConfig,
database: D,
) -> Result<Self, ContextCacheError>
pub async fn init_from_chain_height<D: Database + Clone>( chain_height: usize, config: HardForkConfig, database: D, ) -> Result<Self, ContextCacheError>
Initialize the HardForkState from the specified chain height.
Sourcepub async fn pop_blocks_main_chain<D: Database + Clone>(
&mut self,
numb_blocks: usize,
database: D,
) -> Result<(), ContextCacheError>
pub async fn pop_blocks_main_chain<D: Database + Clone>( &mut self, numb_blocks: usize, database: D, ) -> Result<(), ContextCacheError>
Pop some blocks from the top of the cache.
The cache will be returned to the state it would have been in numb_blocks ago.
§Invariant
This must only be used on a main-chain cache.
Sourcepub fn hardfork_infos(&self) -> Vec<HardForkInfo>
pub fn hardfork_infos(&self) -> Vec<HardForkInfo>
Returns info on all hard-forks.
Sourcepub const fn current_hardfork(&self) -> HardFork
pub const fn current_hardfork(&self) -> HardFork
Returns the current hard-fork.
Trait Implementations§
Source§impl Clone for HardForkState
impl Clone for HardForkState
Source§fn clone(&self) -> HardForkState
fn clone(&self) -> HardForkState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HardForkState
impl Debug for HardForkState
impl Eq for HardForkState
Source§impl PartialEq for HardForkState
impl PartialEq for HardForkState
impl StructuralPartialEq for HardForkState
Auto Trait Implementations§
impl Freeze for HardForkState
impl RefUnwindSafe for HardForkState
impl Send for HardForkState
impl Sync for HardForkState
impl Unpin for HardForkState
impl UnsafeUnpin for HardForkState
impl UnwindSafe for HardForkState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 576 bytes