Skip to content

Commit fe07fba

Browse files
committed
Simplify algorithm
1 parent 0fc1783 commit fe07fba

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

crates/batcher/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -637,18 +637,18 @@ impl Batcher {
637637

638638
async fn user_has_proofs_in_queue(&self, user_address: Address) -> bool {
639639
let user_states = self.user_states.read().await;
640-
if let Some(user_state) = user_states.get(&user_address) {
641-
if let Some(user_state_guard) = self
642-
.try_user_lock_with_timeout(user_address, user_state.lock())
643-
.await
644-
{
645-
user_state_guard.proofs_in_batch > 0
646-
} else {
647-
false
648-
}
649-
} else {
650-
false
651-
}
640+
let Some(user_state) = user_states.get(&user_address) else {
641+
return false;
642+
};
643+
644+
let Some(user_state_guard) = self
645+
.try_user_lock_with_timeout(user_address, user_state.lock())
646+
.await
647+
else {
648+
return false;
649+
};
650+
651+
user_state_guard.proofs_in_batch > 0
652652
}
653653

654654
async fn remove_user_proofs_and_reset_state(&self, user_address: Address) {

0 commit comments

Comments
 (0)