@@ -105,11 +105,6 @@ pub struct Batcher {
105105 /// needs to be stopped, and all user_states locks need to be taken
106106 batch_state : Mutex < BatchState > ,
107107
108- /// Flag to indicate when recovery is in progress
109- /// When true, message handlers will return ServerBusy responses
110- /// It's used a way to "lock" all the user_states at the same time
111- /// If one needed is taken in the handle message it will time out
112- is_recovering_from_submission_failure : RwLock < bool > ,
113108 user_states : Arc < RwLock < HashMap < Address , Arc < Mutex < UserState > > > > > ,
114109
115110 last_uploaded_batch_block : Mutex < u64 > ,
@@ -328,7 +323,6 @@ impl Batcher {
328323 batch_state : Mutex :: new ( batch_state) ,
329324 user_states,
330325 disabled_verifiers : Mutex :: new ( disabled_verifiers) ,
331- is_recovering_from_submission_failure : RwLock :: new ( false ) ,
332326 metrics,
333327 telemetry,
334328 }
@@ -702,17 +696,6 @@ impl Batcher {
702696 mut address : Address ,
703697 ws_conn_sink : WsMessageSink ,
704698 ) -> Result < ( ) , Error > {
705- // Check if restoration is in progress
706- if * self . is_recovering_from_submission_failure . read ( ) . await {
707- warn ! (
708- "Rejecting nonce request from {} during restoration" ,
709- address
710- ) ;
711- let response = GetNonceResponseMessage :: ServerBusy ;
712- send_message ( ws_conn_sink, response) . await ;
713- return Ok ( ( ) ) ;
714- }
715-
716699 // If the address is not paying, we will return the nonce of the aligned_payment_address
717700 if !self . has_to_pay ( & address) {
718701 info ! ( "Handling nonpaying message" ) ;
@@ -797,21 +780,6 @@ impl Batcher {
797780 debug ! ( "Received message with nonce: {msg_nonce:?}" ) ;
798781 self . metrics . received_proofs . inc ( ) ;
799782
800- // Check if restoration is in progress
801- if * self . is_recovering_from_submission_failure . read ( ) . await {
802- warn ! (
803- "Rejecting proof submission from {} during restoration (nonce: {})" ,
804- client_msg
805- . verification_data
806- . verification_data
807- . proof_generator_addr,
808- msg_nonce
809- ) ;
810- let response = SubmitProofResponseMessage :: ServerBusy ;
811- send_message ( ws_conn_sink, response) . await ;
812- return Ok ( ( ) ) ;
813- }
814-
815783 // * ---------------------------------------------------*
816784 // * Perform validations over the message *
817785 // * ---------------------------------------------------*
@@ -1619,9 +1587,7 @@ impl Batcher {
16191587 failed_batch. len( )
16201588 ) ;
16211589
1622- // Set restoration flag to stop handling new user messages
1623- * self . is_recovering_from_submission_failure . write ( ) . await = true ;
1624-
1590+ let user_states_lock = self . user_states . blocking_write ( ) ;
16251591 let mut batch_state_lock = self . batch_state . lock ( ) . await ;
16261592 let mut restored_entries = Vec :: new ( ) ;
16271593
@@ -1687,8 +1653,8 @@ impl Batcher {
16871653 // Only auxiliary user data (max_min_fee) can be "inconsistent"
16881654 // but we can keep updating it without locking the queue
16891655 info ! ( "Queue recovered from submission failure, resuming user processing and updating user states metadata" ) ;
1656+ std:: mem:: drop ( user_states_lock) ;
16901657 std:: mem:: drop ( batch_state_lock) ;
1691- * self . is_recovering_from_submission_failure . write ( ) . await = false ;
16921658
16931659 info ! ( "Updating user states after proof restoration..." ) ;
16941660 if let Err ( e) = self
0 commit comments