From ed867ba93800fd2ae55d526458a999e991dc7d96 Mon Sep 17 00:00:00 2001 From: Noah Vesely Date: Mon, 26 Mar 2018 17:10:38 -0600 Subject: [PATCH] Remove `ShareIdentifierTooBig` error and validation Since id is a `u8` it will never be greater than 255. --- src/errors.rs | 5 ----- src/share/validation.rs | 4 ---- 2 files changed, 9 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index c2b7496..6940357 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -59,11 +59,6 @@ error_chain! { display("The shares are incompatible with each other.") } - ShareIdentifierTooBig(id: u8, n: u8) { - description("Share identifier too big") - display("Found share identifier ({}) bigger than the maximum number of shares ({}).", id, n) - } - MissingShares(provided: usize, required: usize) { description("The number of shares provided is insufficient to recover the secret.") display("{} shares are required to recover the secret, found only {}.", required, provided) diff --git a/src/share/validation.rs b/src/share/validation.rs index f8f94ad..139f3f7 100644 --- a/src/share/validation.rs +++ b/src/share/validation.rs @@ -37,10 +37,6 @@ pub(crate) fn validate_shares(shares: Vec) -> Result<(u8, Vec) for share in shares { let (id, threshold) = (share.get_id(), share.get_threshold()); - if id > MAX_SHARES { - bail!(ErrorKind::ShareIdentifierTooBig(id, MAX_SHARES)) - } - if id < 1 { bail!(ErrorKind::ShareParsingInvalidShareId(id)) }