fix: properly convert canon chain event (#9736)

This commit is contained in:
Matthias Seitz
2024-07-23 19:55:07 +02:00
committed by GitHub
parent 536381d02d
commit 5a9de035bf
2 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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,
)),