From d57163709f10c213ce4cceee1e2d047841b7f583 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 31 Jul 2024 18:50:20 +0200 Subject: [PATCH] feat: set pending block in canonical memory (#9950) --- crates/engine/tree/src/tree/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 3e6a2712ab..9ec360b849 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -1311,6 +1311,13 @@ where hashed_state: Arc::new(hashed_state), trie: Arc::new(trie_output), }; + + if self.state.tree_state.canonical_block_hash() == executed.block().parent_hash { + debug!(target: "engine", pending = ?executed.block().num_hash() ,"updating pending block"); + // if the parent is the canonical head, we can insert the block as the pending block + self.canonical_in_memory_state.set_pending_block(executed.clone()); + } + self.state.tree_state.insert_executed(executed); let attachment = BlockAttachment::Canonical; // TODO: remove or revise attachment