Skip to content

Commit 4977b1f

Browse files
committed
Refactor
1 parent 61b606a commit 4977b1f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

crates/batcher/src/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,11 @@ impl Batcher {
18261826
// TODO: In the future, we should re-add the failed batch back to the queue
18271827
// For now, we flush everything as a safety measure
18281828
self.flush_queue_and_clear_nonce_cache().await;
1829+
1830+
// Return a different error that indicates state was corrupted and flushed
1831+
return Err(BatcherError::StateCorruptedAndFlushed(
1832+
format!("Queue and user states flushed due to insufficient balance for user {:?}", address)
1833+
));
18291834
}
18301835
_ => {
18311836
// Add more cases here if we want in the future
@@ -1954,14 +1959,10 @@ impl Batcher {
19541959
if let Err(e) = batch_finalization_result {
19551960
error!("Batch finalization failed: {:?}", e);
19561961

1957-
// Don't restore proofs for insufficient balance errors - the queue was already flushed
1962+
// If the queue was flushed, don't recover
19581963
match &e {
1959-
BatcherError::TransactionSendError(
1960-
TransactionSendError::SubmissionInsufficientBalance(_),
1961-
) => {
1962-
info!(
1963-
"Queue was flushed due to insufficient balance - not restoring proofs"
1964-
);
1964+
BatcherError::StateCorruptedAndFlushed(_) => {
1965+
info!("State was corrupted and flushed - not restoring proofs");
19651966
}
19661967
_ => {
19671968
info!("Restoring proofs to queue after batch failure");

0 commit comments

Comments
 (0)