From 913e88306b015c7da34a032e953d26b1ede734ff Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 6 Feb 2026 15:26:26 +0400 Subject: [PATCH] fix: only exit when both channels are drained (#21877) Co-authored-by: Matthias Seitz --- .../src/tree/payload_processor/sparse_trie.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_processor/sparse_trie.rs b/crates/engine/tree/src/tree/payload_processor/sparse_trie.rs index b8421206b7..6942d2569d 100644 --- a/crates/engine/tree/src/tree/payload_processor/sparse_trie.rs +++ b/crates/engine/tree/src/tree/payload_processor/sparse_trie.rs @@ -436,6 +436,14 @@ where self.dispatch_pending_targets(); self.process_new_updates()?; self.promote_pending_account_updates()?; + + if self.finished_state_updates && + self.account_updates.is_empty() && + self.storage_updates.iter().all(|(_, updates)| updates.is_empty()) + { + break; + } + self.dispatch_pending_targets(); } else if self.updates.is_empty() || self.pending_updates > MAX_PENDING_UPDATES { // If we don't have any pending updates OR we've accumulated a lot already, apply @@ -446,13 +454,6 @@ where // Make sure to dispatch targets if we've accumulated a lot of them. self.dispatch_pending_targets(); } - - if self.finished_state_updates && - self.account_updates.is_empty() && - self.storage_updates.iter().all(|(_, updates)| updates.is_empty()) - { - break; - } } debug!(target: "engine::root", "All proofs processed, ending calculation");