From 42967bcd6efec744f3a725d6ec27ed85df026379 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Mon, 5 Feb 2024 19:50:53 +0200 Subject: [PATCH] Move `wait_for_previous_l1_batch_hash()` invocation --- core/lib/zksync_core/src/state_keeper/io/mempool.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/lib/zksync_core/src/state_keeper/io/mempool.rs b/core/lib/zksync_core/src/state_keeper/io/mempool.rs index 650e0847cc45..a792161b26e3 100644 --- a/core/lib/zksync_core/src/state_keeper/io/mempool.rs +++ b/core/lib/zksync_core/src/state_keeper/io/mempool.rs @@ -161,8 +161,6 @@ impl StateKeeperIO for MempoolIO { max_wait: Duration, ) -> Option<(SystemEnv, L1BatchEnv)> { let deadline = Instant::now() + max_wait; - // FIXME: why do we wait for hash immediately and not below? (changed in #809) - let prev_l1_batch_hash = self.wait_for_previous_l1_batch_hash().await; // Block until at least one transaction in the mempool can match the filter (or timeout happens). // This is needed to ensure that block timestamp is not too old. @@ -194,12 +192,13 @@ impl StateKeeperIO for MempoolIO { protocol_version.into(), ) .await; - // We only need to get the root hash when we're certain that we have a new transaction. if !self.mempool.has_next(&self.filter) { tokio::time::sleep(self.delay_interval).await; continue; } + // We only need to get the root hash when we're certain that we have a new transaction. + let prev_l1_batch_hash = self.wait_for_previous_l1_batch_hash().await; return Some(l1_batch_params( self.current_l1_batch_number, self.fee_account,