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: StumpThe acc we use for validation.
chainstore: PersistedStateAll data is persisted here.
best_block: BestChainBest 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: boolAre we in Initial Block Download?
consensus: ConsensusParameters 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.