From c373aa2dfee45a47719d1ed6b19c5fe752d98f23 Mon Sep 17 00:00:00 2001 From: Federico Gimenez Date: Wed, 20 Nov 2024 13:08:33 +0100 Subject: [PATCH] use different ConsistentDbView for each SR calculation --- crates/engine/tree/src/tree/mod.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index a0c6f1b0a53c7..08331b7521a6f 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -2199,8 +2199,7 @@ where let input = self .compute_trie_input(consistent_view.clone(), block.parent_hash) .map_err(|e| InsertBlockErrorKindTwo::Other(Box::new(e)))?; - let state_root_config = - StateRootConfig { consistent_view: consistent_view.clone(), input: Arc::new(input) }; + let state_root_config = StateRootConfig { consistent_view, input: Arc::new(input) }; let receiver_stream = StdReceiverStream::new(state_root_rx); let state_root_task = StateRootTask::new(state_root_config, receiver_stream); let state_root_handle = state_root_task.spawn(); @@ -2243,6 +2242,7 @@ where // per thread and it might end up with a different view of the database. let persistence_in_progress = self.persistence_state.in_progress(); if !persistence_in_progress { + let consistent_view = ConsistentDbView::new_with_latest_tip(self.provider.clone())?; let mut input = self .compute_trie_input(consistent_view.clone(), block.parent_hash) .map_err(|e| InsertBlockErrorKindTwo::Other(Box::new(e)))?; @@ -2260,8 +2260,13 @@ where } let (state_root, trie_output) = if let Some(result) = state_root_result { - if let Ok(state_root_task_result) = state_root_handle.wait_for_result() { - debug!(target: "engine::tree", block=?sealed_block.num_hash(), state_root_task_result=?state_root_task_result.0, regular_state_root_result = ?result.0); + match state_root_handle.wait_for_result() { + Ok(state_root_task_result) => { + info!(target: "engine::tree", block=?sealed_block.num_hash(), state_root_task_result=?state_root_task_result.0, regular_state_root_result = ?result.0); + } + Err(e) => { + info!(target: "engine::tree", error=?e, "on state root task wait_for_result") + } } result } else {