11use std:: { sync:: Arc , time:: Duration } ;
22
33use anyhow:: anyhow;
4- use slog:: { Logger , error, trace, warn} ;
4+ use slog:: { Logger , debug , error, trace, warn} ;
55
66use mithril_common:: {
77 StdResult ,
@@ -10,7 +10,7 @@ use mithril_common::{
1010} ;
1111use tokio:: { select, sync:: watch:: Receiver } ;
1212
13- use crate :: MetricsService ;
13+ use crate :: { MetricsService , services :: CertifierServiceError } ;
1414
1515use super :: { CertifierService , SignatureConsumer } ;
1616
@@ -90,13 +90,24 @@ impl SignatureProcessor for SequentialSignatureProcessor {
9090 . get_signature_registration_total_successful_since_startup ( )
9191 . increment ( & [ & origin_network] ) ;
9292 }
93- Err ( e) => {
94- total_import_errors += 1 ;
95- error ! (
96- self . logger, "Error dispatching single signature" ;
97- "full_payload" => #?signature, "error" => ?e
98- ) ;
99- }
93+ Err ( err) => match err. downcast_ref :: < CertifierServiceError > ( ) {
94+ Some ( CertifierServiceError :: AlreadyCertified ( signed_entity_type) ) => {
95+ debug ! ( self . logger, "process_signatures::open_message_already_certified" ; "signed_entity_type" => ?signed_entity_type, "party_id" => & signature. party_id) ;
96+ }
97+ Some ( CertifierServiceError :: Expired ( signed_entity_type) ) => {
98+ debug ! ( self . logger, "process_signatures::open_message_expired" ; "signed_entity_type" => ?signed_entity_type, "party_id" => & signature. party_id) ;
99+ }
100+ Some ( CertifierServiceError :: NotFound ( signed_entity_type) ) => {
101+ debug ! ( self . logger, "process_signatures::not_found" ; "signed_entity_type" => ?signed_entity_type, "party_id" => & signature. party_id) ;
102+ }
103+ Some ( _) | None => {
104+ total_import_errors += 1 ;
105+ error ! (
106+ self . logger, "Error dispatching single signature" ;
107+ "full_payload" => #?signature, "error" => ?err
108+ ) ;
109+ }
110+ } ,
100111 }
101112 }
102113 }
0 commit comments