Skip to content

Commit

Permalink
Move wait_for_previous_l1_batch_hash() invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Feb 5, 2024
1 parent 7d05846 commit 42967bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/lib/zksync_core/src/state_keeper/io/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 42967bc

Please sign in to comment.