Move incorrect number of commitments check to part2 in the DKG

This commit is contained in:
natalie 2024-01-17 10:40:19 +00:00
parent db48fa2cc8
commit 227dc3a2e8
1 changed files with 6 additions and 4 deletions

View File

@ -406,6 +406,12 @@ pub fn part2<C: Ciphersuite>(
return Err(Error::IncorrectNumberOfPackages);
}
for package in round1_packages.values() {
if package.commitment.0.len() != secret_package.min_signers as usize {
return Err(Error::IncorrectNumberOfCommitments);
}
}
let mut round2_packages = BTreeMap::new();
for (sender_identifier, round1_package) in round1_packages {
@ -506,10 +512,6 @@ pub fn part3<C: Ciphersuite>(
commitment: commitment.clone(),
};
if secret_share.commitment.0.len() != round2_secret_package.min_signers {
return Err(Error::IncorrectNumberOfCommitments);
}
// Verify the share. We don't need the result.
let _ = secret_share.verify()?;