diff --git a/src/state_machine/coordinator/fire.rs b/src/state_machine/coordinator/fire.rs index 598420f..4d70437 100644 --- a/src/state_machine/coordinator/fire.rs +++ b/src/state_machine/coordinator/fire.rs @@ -54,7 +54,6 @@ pub struct Coordinator { nonce_start: Option, sign_start: Option, malicious_signer_ids: HashSet, - malicious_key_ids: HashSet, } impl Coordinator { @@ -90,16 +89,16 @@ impl Coordinator { for signer_id in &self.sign_wait_signer_ids { warn!("Mark signer {} as malicious", signer_id); self.malicious_signer_ids.insert(*signer_id); - for key_id in &self.config.signer_key_ids[signer_id] { - debug!("Mark key {} as malicious", key_id); - self.malicious_key_ids.insert(*key_id); - } } - if self.config.num_keys - (self.malicious_key_ids.len() as u32) - < self.config.threshold - { - warn!("Too many malicious signers to continue"); + let num_malicious_keys: u32 = self + .malicious_signer_ids + .iter() + .map(|signer_id| self.config.signer_key_ids[signer_id].len() as u32) + .sum(); + + if self.config.num_keys - num_malicious_keys < self.config.threshold { + warn!("Insufficient non-malicious signers to continue"); return Ok(( None, Some(OperationResult::SignError( @@ -650,7 +649,6 @@ impl CoordinatorTrait for Coordinator { nonce_start: None, sign_start: None, malicious_signer_ids: Default::default(), - malicious_key_ids: Default::default(), } }