Skip to content

Commit

Permalink
add doc and into
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed Jan 23, 2025
1 parent c740aec commit 01f1884
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/chain-state/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,21 @@ impl<N: NodePrimitives> ExecutedBlock<N> {
///
/// We store it as separate type because [`TrieUpdates`] are only available for blocks stored in
/// memory and can't be obtained for canonical persisted blocks.
#[derive(Clone, Debug, PartialEq, Eq, Default, derive_more::Deref, derive_more::DerefMut)]
#[derive(
Clone,
Debug,
PartialEq,
Eq,
Default,
derive_more::Deref,
derive_more::DerefMut,
derive_more::Into,
)]
pub struct ExecutedBlockWithTrieUpdates<N: NodePrimitives = EthPrimitives> {
/// Inner [`ExecutedBlock`].
#[deref]
#[deref_mut]
#[into]
pub block: ExecutedBlock<N>,
/// Trie updates that result of applying the block.
pub trie: Arc<TrieUpdates>,
Expand Down Expand Up @@ -873,6 +883,9 @@ pub enum NewCanonicalChain<N: NodePrimitives = EthPrimitives> {
/// All blocks of the _new_ chain
new: Vec<ExecutedBlockWithTrieUpdates<N>>,
/// All blocks of the _old_ chain
/// These are not [`ExecutedBlockWithTrieUpdates`] because we don't always have the trie
/// updates for the old canonical chain. For example, in case of node being restarted right
/// before the reorg TrieUpdates can't be fetched from database and won't be available.
old: Vec<ExecutedBlock<N>>,
},
}
Expand Down

0 comments on commit 01f1884

Please sign in to comment.