diff --git a/crates/chain-state/src/in_memory.rs b/crates/chain-state/src/in_memory.rs index 1e6184d180..6b7cda23b4 100644 --- a/crates/chain-state/src/in_memory.rs +++ b/crates/chain-state/src/in_memory.rs @@ -360,6 +360,13 @@ impl ExecutedBlock { &self.senders } + /// Returns a [`SealedBlockWithSenders`] + /// + /// Note: this clones the block and senders. + pub fn sealed_block_with_senders(&self) -> SealedBlockWithSenders { + SealedBlockWithSenders { block: (*self.block).clone(), senders: (*self.senders).clone() } + } + /// Returns a reference to the block's execution outcome pub fn execution_outcome(&self) -> &ExecutionOutcome { &self.execution_output diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index d8eadd68e6..ff4ec562fe 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -213,19 +213,19 @@ impl NewCanonicalChain { match self { Self::Commit { new } => CanonStateNotification::Commit { new: Arc::new(Chain::new( - vec![], + new.iter().map(ExecutedBlock::sealed_block_with_senders), new.last().unwrap().execution_output.deref().clone(), None, )), }, Self::Reorg { new, old } => CanonStateNotification::Reorg { - old: Arc::new(Chain::new( - vec![], + new: Arc::new(Chain::new( + new.iter().map(ExecutedBlock::sealed_block_with_senders), new.last().unwrap().execution_output.deref().clone(), None, )), - new: Arc::new(Chain::new( - vec![], + old: Arc::new(Chain::new( + old.iter().map(ExecutedBlock::sealed_block_with_senders), old.last().unwrap().execution_output.deref().clone(), None, )),