Skip to content

Commit 0c6159a

Browse files
committed
Remove unused lock
1 parent 9b9e819 commit 0c6159a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

crates/batcher/src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ pub struct Batcher {
103103
/// needs to be stopped, and all user_states locks need to be taken
104104
batch_state: Mutex<BatchState>,
105105
user_states: DashMap<Address, Arc<Mutex<UserState>>>,
106-
/// When posting a task, this is taken as a write to stop new threads to update
107-
/// user_states, ideally we would want a bigger mutex on the whole user_states, but this can't be done
108-
batch_processing_lock: RwLock<()>,
109-
106+
110107
last_uploaded_batch_block: Mutex<u64>,
111108

112109
/// This is used to avoid multiple batches being submitted at the same time
@@ -712,8 +709,6 @@ impl Batcher {
712709
client_msg: Box<SubmitProofMessage>,
713710
ws_conn_sink: WsMessageSink,
714711
) -> Result<(), Error> {
715-
// Acquire read lock to allow concurrent user processing but block during batch creation
716-
let _batch_processing_guard = self.batch_processing_lock.read().await;
717712

718713
let msg_nonce = client_msg.verification_data.nonce;
719714
debug!("Received message with nonce: {msg_nonce:?}");
@@ -870,6 +865,8 @@ impl Batcher {
870865

871866
// In this case, the message might be a replacement one. If it is valid,
872867
// we replace the old entry with the new from the replacement message.
868+
// Notice this stops the normal flow of the handle_submit_proof.
869+
// locks will be taken inside this function
873870
if expected_nonce > msg_nonce {
874871
info!("Possible replacement message received: Expected nonce {expected_nonce:?} - message nonce: {msg_nonce:?}");
875872
self.handle_replacement_message(
@@ -1543,8 +1540,6 @@ impl Batcher {
15431540
finalized_batch: &[BatchQueueEntry],
15441541
gas_price: U256,
15451542
) -> Result<(), BatcherError> {
1546-
// Acquire write lock to ensure exclusive access during batch creation (blocks all user processing)
1547-
let _batch_processing_guard = self.batch_processing_lock.write().await;
15481543

15491544
let nonced_batch_verifcation_data: Vec<NoncedVerificationData> = finalized_batch
15501545
.iter()

0 commit comments

Comments
 (0)