Skip to content

Commit

Permalink
fix: add wait for verification (#360)
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Arce <52429267+JuArce@users.noreply.github.com>
  • Loading branch information
NicolasRampoldi and JuArce authored Jun 10, 2024
1 parent b9e98fe commit 9faf0df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ impl Batcher {
&self,
block_number: u64,
finalized_batch: BatchQueue,
wait_for_verification: bool,
) -> Result<(), BatcherError> {
let batch_verification_data: Vec<VerificationData> = finalized_batch
.clone()
Expand Down Expand Up @@ -298,6 +299,11 @@ impl Batcher {
*last_uploaded_batch_block = block_number;
}

if !wait_for_verification {
send_batch_inclusion_data_responses(finalized_batch, &batch_merkle_tree).await;
return Ok(());
}

// This future is created to be passed to the timeout function, so that if it is not resolved
// within the timeout interval an error is raised. If the event is received, responses are sent to
// connected clients
Expand All @@ -316,7 +322,7 @@ impl Batcher {
/// finalizes the batch.
async fn handle_new_block(&self, block_number: u64) -> Result<(), BatcherError> {
while let Some(finalized_batch) = self.is_batch_ready(block_number).await {
self.finalize_batch(block_number, finalized_batch).await?;
self.finalize_batch(block_number, finalized_batch, false).await?;
}
Ok(())
}
Expand Down

0 comments on commit 9faf0df

Please sign in to comment.