File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,7 +308,6 @@ async fn batch_payload_handler(
308308 item. m3ter_id ,
309309 extract_nonce ( & item. message ) ,
310310 )
311- . expect ( "Failed to check uniqueness" )
312311 } )
313312 . map ( |payload| {
314313 let m3ter_id = payload. m3ter_id ;
@@ -527,6 +526,32 @@ async fn update_payload(
527526 } ) ;
528527}
529528
529+ fn is_unique_nonce (
530+ connection : & mut PooledConnection < ConnectionManager < PgConnection > > ,
531+ i_m3ter_id : i64 ,
532+ i_nonce : i64 ,
533+ ) -> bool {
534+ use self :: m3ter_payloads:: dsl:: * ;
535+ use diesel:: prelude:: * ;
536+
537+ match m3ter_payloads
538+ . filter ( m3ter_id. eq ( i_m3ter_id) . and ( nonce. eq ( i_nonce) ) )
539+ . first :: < M3terPayload > ( connection)
540+ {
541+ Ok ( _) => {
542+ println ! (
543+ "Nonce {} for m3ter {} already exists in the database" ,
544+ i_nonce, i_m3ter_id
545+ ) ;
546+ false
547+ }
548+ Err ( _) => {
549+ println ! ( "Nonce {} for m3ter {} is unique" , i_nonce, i_m3ter_id) ;
550+ true
551+ }
552+ }
553+ }
554+
530555fn create_proof_fixture ( proof : & SP1ProofWithPublicValues , vk : & SP1VerifyingKey ) -> ProofFixture {
531556 let bytes = proof. public_values . as_slice ( ) ;
532557 let output = PublicValuesStruct :: from_bytes ( bytes) ;
You can’t perform that action at this time.
0 commit comments