pub fn check_threshold_is_feasible(
        threshold: NumberOfNodes,
    ) -> Result<(), DkgCreateTranscriptError> {
        if threshold.get() > (NodeIndex::max_value() - 1) / 2 + 1 {
            return Err(DkgCreateTranscriptError::InvalidThresholdError(
                InvalidArgumentError {
                    message: "Threshold too high".to_string(),
                },
            ));
        }
        Ok(())
    }
/// If the threshold is too high, the required number of responses cannot be
/// reached.
///
/// The somewhat contorted arithmetic is to avoid wrapping errors.
///
/// Hypothetical examples:
/// * NodeIndex::max_value == 2**16-1
///   * max threshold == 2**15
///   * required num_responses == 2*threshold-1 == 2**16-1
/// * NodeIndex::max_value == 2**16
///   * max threshold == 2**15
///   * required num_responses == 2*threshold-1
If the threshold is too high, the required number of responses cannot be
reached.

The somewhat contorted arithmetic is to avoid wrapping errors.


If the threshold is too high the required number of responses cannot be reached . The somewhat contorted arithmetic is to avoid wrapping errors .
pub fn check_threshold_is_feasible(
        threshold: NumberOfNodes,
    ) -> Result<(), DkgCreateTranscriptError> {
        if threshold.get() > (NodeIndex::max_value() - 1) / 2 + 1 {
            return Err(DkgCreateTranscriptError::InvalidThresholdError(
                InvalidArgumentError {
                    message: "Threshold too high".to_string(),
                },
            ));
        }
        Ok(())
    }
pub fn check_threshold_is_feasible ( threshold : NumberOfNodes , ) -> Result < ( ) , DkgCreateTranscriptError > { if threshold . get ( ) > ( NodeIndex :: max_value ( ) - 1 ) / 2 + 1 { return Err ( DkgCreateTranscriptError :: InvalidThresholdError ( InvalidArgumentError { message : " " . to_string ( ) , } , ) ) ; } Ok ( ( ) ) }
If the threshold is too high, the required number of responses cannot be
reached.
If the threshold is too high the required number of responses cannot be reached .
threshold
NumberOfNodes
threshold
NumberOfNodes