/// Creates a new non-interactive DKG config.
///
/// A `NiDkgConfig` can only be created if the following invariants hold:
/// * The threshold is not zero (error: `ThresholdZero`),
/// * The threshold is greater than max_corrupt_receivers (error:
///   `InsufficientThreshold`)
/// * The dealers and receivers are not empty (errors: `DealersEmpty`,
///   `ReceiversEmpty`)
/// * The number of dealers and receivers fit into `NumberOfNodes` (errors:
///   `TooManyDealers`, `TooManyReceivers`)
/// * The number of dealers is greater than max_corrupt_dealers (error:
///   `InsufficientDealers`)
/// * The number of receivers is greater than or equal to
///   max_corrupt_receivers + threshold (error: `InsufficientReceivers`).
/// * If a resharing transcript is present:
///   * The dealers are all contained in the transcript's committee. (error:
///     `DealersNotInResharingCommittee`)
///   * The number of dealers is greater than or equal to the transcript's
///     threshold. (error: `InsufficientDealersForResharingThreshold`)
///
/// If an invariant is not satisfied, the `Err` as indicated above is
/// returned.
Creates a new non-interactive DKG config.

If an invariant is not satisfied, the `Err` as indicated above is
returned.
Creates a new non - interactive DKG config . If an invariant is not satisfied the ` Err ` as indicated above is returned .
pub fn new(data: NiDkgConfigData) -> Result<Self, NiDkgConfigValidationError> {
        let threshold = NiDkgThreshold::new(data.threshold)?;
        let dealers = NiDkgDealers::new(data.dealers)?;
        let receivers = NiDkgReceivers::new(data.receivers)?;
        Self::ensure_sufficient_threshold(threshold, data.max_corrupt_receivers)?;
        Self::ensure_sufficient_dealers(&dealers, data.max_corrupt_dealers)?;
        Self::ensure_sufficient_receivers(&receivers, data.max_corrupt_receivers, threshold)?;
        if let Some(rs_transcript) = &data.resharing_transcript {
            Self::ensure_dealers_contained_in_resharing_committee(&dealers, rs_transcript)?;
            Self::ensure_sufficient_dealers_for_resharing_threshold(&dealers, rs_transcript)?;
        }
        Ok(Self {
            dkg_id: data.dkg_id,
            max_corrupt_dealers: data.max_corrupt_dealers,
            dealers,
            max_corrupt_receivers: data.max_corrupt_receivers,
            receivers,
            threshold,
            registry_version: data.registry_version,
            resharing_transcript: data.resharing_transcript,
        })
    }
pub fn new ( data : NiDkgConfigData ) -> Result < Self , NiDkgConfigValidationError > { let threshold = NiDkgThreshold :: new ( data . threshold ) ? ; let dealers = NiDkgDealers :: new ( data . dealers ) ? ; let receivers = NiDkgReceivers :: new ( data . receivers ) ? ; Self :: ensure_sufficient_threshold ( threshold , data . max_corrupt_receivers ) ? ; Self :: ensure_sufficient_dealers ( & dealers , data . max_corrupt_dealers ) ? ; Self :: ensure_sufficient_receivers ( & receivers , data . max_corrupt_receivers , threshold ) ? ; if let Some ( rs_transcript ) = & data . resharing_transcript { Self :: ensure_dealers_contained_in_resharing_committee ( & dealers , rs_transcript ) ? ; Self :: ensure_sufficient_dealers_for_resharing_threshold ( & dealers , rs_transcript ) ? ; } Ok ( Self { dkg_id : data . dkg_id , max_corrupt_dealers : data . max_corrupt_dealers , dealers , max_corrupt_receivers : data . max_corrupt_receivers , receivers , threshold , registry_version : data . registry_version , resharing_transcript : data . resharing_transcript , } ) }
Creates a new non-interactive DKG config.
Creates a new non - interactive DKG config .
data
NiDkgConfigData