@@ -636,17 +636,9 @@ impl Batcher {
636636 }
637637 }
638638
639- if self . is_nonpaying ( & addr) {
639+ if self . is_nonpaying ( & addr) && self . non_paying_config . is_some ( ) {
640640 info ! ( "Generating non-paying data" ) ;
641- let Ok ( non_paying_data) = self . generate_non_paying_data ( & client_msg) . await else {
642- error ! ( "Failed to generate non paying data" ) ;
643- send_message (
644- ws_conn_sink. clone ( ) ,
645- SubmitProofResponseMessage :: NonPayingNotAllowed ,
646- )
647- . await ;
648- return Ok ( ( ) ) ;
649- } ;
641+ let non_paying_data = self . generate_non_paying_data ( & client_msg) . await ;
650642 addr = non_paying_data. address ;
651643 nonced_verification_data = non_paying_data. nonced_verification_data ;
652644 signature = non_paying_data. signature ;
@@ -1770,12 +1762,9 @@ impl Batcher {
17701762 async fn generate_non_paying_data (
17711763 & self ,
17721764 client_msg : & SubmitProofMessage ,
1773- ) -> Result < NonPayingReplacementData , TransactionSendError > {
1774- info ! ( "Handling nonpaying message" ) ;
1775- let Some ( non_paying_config) = self . non_paying_config . as_ref ( ) else {
1776- warn ! ( "There isn't a non-paying configuration loaded. This message will be ignored" ) ;
1777- return Err ( TransactionSendError :: NonPayingNotAllowed ) ;
1778- } ;
1765+ ) -> NonPayingReplacementData {
1766+ // This unwrap is safe because we check if the non-paying config is set before calling this function.
1767+ let non_paying_config = self . non_paying_config . as_ref ( ) . unwrap ( ) ;
17791768
17801769 let nonced_verification_data = NoncedVerificationData :: new (
17811770 client_msg. verification_data . verification_data . clone ( ) ,
@@ -1792,12 +1781,11 @@ impl Batcher {
17921781 )
17931782 . await ;
17941783
1795- info ! ( "Non-paying verification data message handled" ) ;
1796- Ok ( NonPayingReplacementData {
1784+ NonPayingReplacementData {
17971785 address : non_paying_config. replacement . address ( ) ,
17981786 nonced_verification_data,
17991787 signature : non_paying_replacement_msg. signature ,
1800- } )
1788+ }
18011789 }
18021790
18031791 /// Gets the balance of user with address `addr` from Ethereum.
0 commit comments