Struct BlockchainContext
pub struct BlockchainContext {
pub cumulative_difficulty: u128,
pub context_to_verify_block: ContextToVerifyBlock,
/* private fields */
}Expand description
Raw blockchain context, gotten from BlockchainContext. This data may turn invalid so is not ok to keep
around. You should keep around BlockchainContext instead.
Fields§
§cumulative_difficulty: u128The current cumulative difficulty.
context_to_verify_block: ContextToVerifyBlockContext to verify a block, as needed by [cuprate_consensus_rules]
Implementations§
§impl BlockchainContext
impl BlockchainContext
pub fn long_term_effective_median_weight(&self) -> usize
pub fn long_term_effective_median_weight(&self) -> usize
Returns the long-term effective median block weight used for relay-fee calculations.
pub fn current_adjusted_timestamp_for_time_lock(&self) -> u64
pub fn current_adjusted_timestamp_for_time_lock(&self) -> u64
Returns the timestamp the should be used when checking locked outputs.
pub fn next_block_long_term_weight(&self, block_weight: usize) -> usize
pub fn next_block_long_term_weight(&self, block_weight: usize) -> usize
Returns the next blocks long term weight from its block weight.
Trait Implementations§
§impl Clone for BlockchainContext
impl Clone for BlockchainContext
§fn clone(&self) -> BlockchainContext
fn clone(&self) -> BlockchainContext
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 more§impl Debug for BlockchainContext
impl Debug for BlockchainContext
§impl Deref for BlockchainContext
impl Deref for BlockchainContext
impl Eq for BlockchainContext
§impl PartialEq for BlockchainContext
impl PartialEq for BlockchainContext
impl StructuralPartialEq for BlockchainContext
Auto Trait Implementations§
impl Freeze for BlockchainContext
impl RefUnwindSafe for BlockchainContext
impl Send for BlockchainContext
impl Sync for BlockchainContext
impl Unpin for BlockchainContext
impl UnsafeUnpin for BlockchainContext
impl UnwindSafe for BlockchainContext
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: 160 bytes