Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,7 @@ impl Batcher {
self.handle_nonpaying_msg(ws_conn_sink.clone(), client_msg)
.await
} else {
if !self
.check_user_balance_and_increment_proof_count(&addr)
.await
{
if !self.check_user_balance(&addr).await {
send_message(
ws_conn_sink.clone(),
ValidityResponseMessage::InsufficientBalance(addr),
Expand Down Expand Up @@ -599,11 +596,11 @@ impl Batcher {

// Checks user has sufficient balance
// If user has sufficient balance, increments the user's proof count in the batch
async fn check_user_balance_and_increment_proof_count(&self, addr: &Address) -> bool {
async fn check_user_balance(&self, addr: &Address) -> bool {
if self.user_balance_is_unlocked(addr).await {
return false;
}
let mut batch_state = self.batch_state.lock().await;
let batch_state = self.batch_state.lock().await;

let user_proofs_in_batch = batch_state.get_user_proof_count(addr) + 1;

Expand All @@ -614,7 +611,6 @@ impl Batcher {
return false;
}

batch_state.increment_user_proof_count(addr);
true
}

Expand Down Expand Up @@ -645,6 +641,7 @@ impl Batcher {

batch_state.user_nonces.insert(addr, nonce + U256::one());
batch_state.user_min_fee.insert(addr, max_fee);
batch_state.increment_user_proof_count(&addr);

self.add_to_batch(
batch_state,
Expand Down