Skip to content

Commit 9faf0df

Browse files
fix: add wait for verification (#360)
Co-authored-by: Julian Arce <[email protected]>
1 parent b9e98fe commit 9faf0df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

batcher/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl Batcher {
264264
&self,
265265
block_number: u64,
266266
finalized_batch: BatchQueue,
267+
wait_for_verification: bool,
267268
) -> Result<(), BatcherError> {
268269
let batch_verification_data: Vec<VerificationData> = finalized_batch
269270
.clone()
@@ -298,6 +299,11 @@ impl Batcher {
298299
*last_uploaded_batch_block = block_number;
299300
}
300301

302+
if !wait_for_verification {
303+
send_batch_inclusion_data_responses(finalized_batch, &batch_merkle_tree).await;
304+
return Ok(());
305+
}
306+
301307
// This future is created to be passed to the timeout function, so that if it is not resolved
302308
// within the timeout interval an error is raised. If the event is received, responses are sent to
303309
// connected clients
@@ -316,7 +322,7 @@ impl Batcher {
316322
/// finalizes the batch.
317323
async fn handle_new_block(&self, block_number: u64) -> Result<(), BatcherError> {
318324
while let Some(finalized_batch) = self.is_batch_ready(block_number).await {
319-
self.finalize_batch(block_number, finalized_batch).await?;
325+
self.finalize_batch(block_number, finalized_batch, false).await?;
320326
}
321327
Ok(())
322328
}

0 commit comments

Comments
 (0)