Skip to content

Commit

Permalink
fix: fix events processing in the finalizer loop (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
montekki authored Aug 11, 2023
1 parent adac650 commit 604c0ca
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions finalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ where
let mut iter = try_finalize_these.into_iter().peekable();

while let Some(t) = iter.next() {
accumulator.add_withdrawal(t.clone());
accumulator.add_withdrawal(t);

if accumulator.ready_to_finalize() || iter.peek().is_none() {
vlog::info!(
Expand All @@ -297,13 +297,14 @@ where
let mut removed = accumulator.remove_unsuccessful(&predicted_to_fail);

self.unsuccessful.append(&mut removed);
continue;
} else {
let requests = accumulator.take_withdrawals();
self.finalize_batch(requests).await?;
accumulator = self.new_accumulator().await?;
}
}

if accumulator.ready_to_finalize() || iter.peek().is_none() {
let requests = accumulator.take_withdrawals();
self.finalize_batch(requests).await?;
accumulator = self.new_accumulator().await?;
}
}

self.process_unsuccessful().await
Expand Down

0 comments on commit 604c0ca

Please sign in to comment.