mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-22 16:25:32 +00:00
More specific validation error when share thresholds mismatch
This commit is contained in:
committed by
Romain Ruetschi
parent
cb13a9b5db
commit
df091b07c1
@ -59,6 +59,11 @@ error_chain! {
|
|||||||
display("The shares are incompatible with each other.")
|
display("The shares are incompatible with each other.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IncompatibleThresholds(sets: Vec<HashSet<u8>>) {
|
||||||
|
description("The shares are incompatible with each other because they do not all have the same threshold.")
|
||||||
|
display("The shares are incompatible with each other because they do not all have the same threshold.")
|
||||||
|
}
|
||||||
|
|
||||||
MissingShares(provided: usize, required: u8) {
|
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)
|
||||||
|
@ -67,7 +67,7 @@ pub(crate) fn validate_shares<S: IsShare>(shares: Vec<S>) -> Result<(u8, Vec<S>)
|
|||||||
1 => {} // All shares have the same roothash.
|
1 => {} // All shares have the same roothash.
|
||||||
_ => {
|
_ => {
|
||||||
bail! {
|
bail! {
|
||||||
ErrorKind::IncompatibleSets(
|
ErrorKind::IncompatibleThresholds(
|
||||||
k_compatibility_sets
|
k_compatibility_sets
|
||||||
.values()
|
.values()
|
||||||
.map(|x| x.to_owned())
|
.map(|x| x.to_owned())
|
||||||
|
Reference in New Issue
Block a user