mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-23 00:35:38 +00:00
MissingShares should take u8
for required
arg
This commit is contained in:
committed by
Romain Ruetschi
parent
fd74534fa1
commit
cb13a9b5db
@ -59,7 +59,7 @@ error_chain! {
|
|||||||
display("The shares are incompatible with each other.")
|
display("The shares are incompatible with each other.")
|
||||||
}
|
}
|
||||||
|
|
||||||
MissingShares(provided: usize, required: usize) {
|
MissingShares(provided: usize, required: u8) {
|
||||||
description("The number of shares provided is insufficient to recover the secret.")
|
description("The number of shares provided is insufficient to recover the secret.")
|
||||||
display("{} shares are required to recover the secret, found only {}.", required, provided)
|
display("{} shares are required to recover the secret, found only {}.", required, provided)
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ pub(crate) fn validate_shares<S: IsShare>(shares: Vec<S>) -> Result<(u8, Vec<S>)
|
|||||||
let threshold = k_compatibility_sets.keys().last().unwrap().to_owned();
|
let threshold = k_compatibility_sets.keys().last().unwrap().to_owned();
|
||||||
|
|
||||||
if shares_count < threshold as usize {
|
if shares_count < threshold as usize {
|
||||||
bail!(ErrorKind::MissingShares(shares_count, threshold as usize));
|
bail!(ErrorKind::MissingShares(shares_count, threshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((threshold, result))
|
Ok((threshold, result))
|
||||||
|
Reference in New Issue
Block a user