pub fn from_state_with_config(
        state: StateWithConfig,
    ) -> Result<Self, ni_dkg_errors::CspDkgCreateReshareDealingError> {
        let StateWithConfig {
            mut network,
            config,
        } = state;
        let dealings: Result<
            BTreeMap<NodeIndex, CspNiDkgDealing>,
            ni_dkg_errors::CspDkgCreateReshareDealingError,
        > = config
            .dealers
            .iter()
            .map(|(node_index, node_id)| {
                let node = network
                    .nodes_by_node_id
                    .get_mut(&node_id)
                    .expect("Could not find dealer in nodes");
                let dealing = node.create_dealing(
                    config.algorithm_id,
                    config
                        .dealers
                        .position(node.node_id)
                        .expect("The node is not in the set of Dealers"),
                    config.threshold.get(),
                    config.epoch,
                    config.receiver_keys.clone(),
                    config
                        .resharing_transcript
                        .as_ref()
                        .map(CspPublicCoefficients::from),
                );
                dealing.map(|dealing| (node_index, dealing))
            })
            .collect();
        Ok(StateWithDealings {
            network,
            config,
            dealings: dealings?,
        })
    }
/// Each dealer creates a dealing.
Each dealer creates a dealing.
Each dealer creates a dealing .
pub fn from_state_with_config(
        state: StateWithConfig,
    ) -> Result<Self, ni_dkg_errors::CspDkgCreateReshareDealingError> {
        let StateWithConfig {
            mut network,
            config,
        } = state;
        let dealings: Result<
            BTreeMap<NodeIndex, CspNiDkgDealing>,
            ni_dkg_errors::CspDkgCreateReshareDealingError,
        > = config
            .dealers
            .iter()
            .map(|(node_index, node_id)| {
                let node = network
                    .nodes_by_node_id
                    .get_mut(&node_id)
                    .expect("Could not find dealer in nodes");
                let dealing = node.create_dealing(
                    config.algorithm_id,
                    config
                        .dealers
                        .position(node.node_id)
                        .expect("The node is not in the set of Dealers"),
                    config.threshold.get(),
                    config.epoch,
                    config.receiver_keys.clone(),
                    config
                        .resharing_transcript
                        .as_ref()
                        .map(CspPublicCoefficients::from),
                );
                dealing.map(|dealing| (node_index, dealing))
            })
            .collect();
        Ok(StateWithDealings {
            network,
            config,
            dealings: dealings?,
        })
    }
pub fn from_state_with_config ( state : StateWithConfig , ) -> Result < Self , ni_dkg_errors :: CspDkgCreateReshareDealingError > { let StateWithConfig { mut network , config , } = state ; let dealings : Result < BTreeMap < NodeIndex , CspNiDkgDealing > , ni_dkg_errors :: CspDkgCreateReshareDealingError , > = config . dealers . iter ( ) . map ( | ( node_index , node_id ) | { let node = network . nodes_by_node_id . get_mut ( & node_id ) . expect ( " " ) ; let dealing = node . create_dealing ( config . algorithm_id , config . dealers . position ( node . node_id ) . expect ( " " ) , config . threshold . get ( ) , config . epoch , config . receiver_keys . clone ( ) , config . resharing_transcript . as_ref ( ) . map ( CspPublicCoefficients :: from ) , ) ; dealing . map ( | dealing | ( node_index , dealing ) ) } ) . collect ( ) ; Ok ( StateWithDealings { network , config , dealings : dealings ? , } ) }
Each dealer creates a dealing.
Each dealer creates a dealing .
state
StateWithConfig
state
StateWithConfig