Skip to content

Commit

Permalink
feat: add sealed_block method to ExecutedBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected committed Jan 23, 2025
1 parent 05b4205 commit b201db7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions crates/chain-state/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,22 +810,32 @@ impl<N: NodePrimitives> ExecutedBlock<N> {
Self { recovered_block, execution_output, hashed_state, trie }
}

/// Returns a reference to an inner [`SealedBlock`]
#[inline]
pub fn sealed_block(&self) -> &SealedBlock<N::Block> {
self.recovered_block.sealed_block()
}

/// Returns a reference to [`RecoveredBlock`]
#[inline]
pub fn recovered_block(&self) -> &RecoveredBlock<N::Block> {
&self.recovered_block
}

/// Returns a reference to the block's execution outcome
#[inline]
pub fn execution_outcome(&self) -> &ExecutionOutcome<N::Receipt> {
&self.execution_output
}

/// Returns a reference to the hashed state result of the execution outcome
#[inline]
pub fn hashed_state(&self) -> &HashedPostState {
&self.hashed_state
}

/// Returns a reference to the trie updates for the block
#[inline]
pub fn trie_updates(&self) -> &TrieUpdates {
&self.trie
}
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ where
EngineApiRequest::InsertExecutedBlock(block) => {
debug!(target: "engine::tree", block=?block.recovered_block().num_hash(), "inserting already executed block");
let now = Instant::now();
let sealed_block = Arc::new(block.recovered_block().sealed_block().clone());
let sealed_block = Arc::new(block.sealed_block().clone());
self.state.tree_state.insert_executed(block);
self.metrics.engine.inserted_already_executed_blocks.increment(1);

Expand Down

0 comments on commit b201db7

Please sign in to comment.