Struct ChainStateInner

Source
pub struct ChainStateInner<PersistedState: ChainStore> {
    acc: Stump,
    chainstore: PersistedState,
    best_block: BestChain,
    subscribers: Vec<Arc<dyn BlockConsumer>>,
    fee_estimation: (f64, f64, f64),
    ibd: bool,
    consensus: Consensus,
    assume_valid: Option<BlockHash>,
}
Expand description

Internal state of the blockchain managed by ChainState.

Fields§

§acc: Stump

The acc we use for validation.

§chainstore: PersistedState

All data is persisted here.

§best_block: BestChain

Best known block, cached in a specific field to faster access.

§subscribers: Vec<Arc<dyn BlockConsumer>>

We may have multiple modules that needs to receive and process blocks as they come, to be notified of new blocks, a module should implement the BlockConsumer trait, and subscribe by passing an Arc of itself to chainstate. When a new block is accepted (as valid) we call on_block from BlockConsumer. If a module just wants pass in a channel, Sender implements BlockConsumer, and can be used during subscription (just keep the Receiver side.

§fee_estimation: (f64, f64, f64)

Fee estimation for 1, 10 and 20 blocks

§ibd: bool

Are we in Initial Block Download?

§consensus: Consensus

Parameters for the chain and functions that verify the chain.

§assume_valid: Option<BlockHash>

Assume valid is a Core-specific config that tells the node to not validate signatures in blocks before this one. Note that we only skip signature validation, everything else is still validated.

Auto Trait Implementations§

§

impl<PersistedState> Freeze for ChainStateInner<PersistedState>
where PersistedState: Freeze,

§

impl<PersistedState> !RefUnwindSafe for ChainStateInner<PersistedState>

§

impl<PersistedState> Send for ChainStateInner<PersistedState>
where PersistedState: Send,

§

impl<PersistedState> Sync for ChainStateInner<PersistedState>
where PersistedState: Sync,

§

impl<PersistedState> Unpin for ChainStateInner<PersistedState>
where PersistedState: Unpin,

§

impl<PersistedState> !UnwindSafe for ChainStateInner<PersistedState>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more