pub fn load<P: AsRef<Path>>(input_path: P) -> Result<Self, Error> {
        let mut config = Self::load_config(&input_path)?;
        if config.base.role.is_validator() {
            invariant(
                config.validator_network.is_some(),
                "Missing a validator network config for a validator node".into(),
            )?;
        } else {
            invariant(
                config.validator_network.is_none(),
                "Provided a validator network config for a full_node node".into(),
            )?;
        }

        let mut network_ids = HashSet::new();
        let input_dir = RootPath::new(input_path);
        config.execution.load(&input_dir)?;
        if let Some(network) = &mut config.validator_network {
            network.load(RoleType::Validator)?;
            network_ids.insert(network.network_id.clone());
        }
        for network in &mut config.full_node_networks {
            network.load(RoleType::FullNode)?;

            // Validate that a network isn't repeated
            let network_id = network.network_id.clone();
            invariant(
                !network_ids.contains(&network_id),
                format!("network_id {:?} was repeated", network_id),
            )?;
            network_ids.insert(network_id);
        }
        config.set_data_dir(config.data_dir().clone());
        Ok(config)
    }
/// Reads the config file and returns the configuration object in addition to doing some
/// post-processing of the config
/// Paths used in the config are either absolute or relative to the config location
Reads the config file and returns the configuration object in addition to doing some
post-processing of the config
Paths used in the config are either absolute or relative to the config location
Reads the config file and returns the configuration object in addition to doing some post - processing of the config Paths used in the config are either absolute or relative to the config location
pub fn load<P: AsRef<Path>>(input_path: P) -> Result<Self, Error> {
        let mut config = Self::load_config(&input_path)?;
        if config.base.role.is_validator() {
            invariant(
                config.validator_network.is_some(),
                "Missing a validator network config for a validator node".into(),
            )?;
        } else {
            invariant(
                config.validator_network.is_none(),
                "Provided a validator network config for a full_node node".into(),
            )?;
        }
        let mut network_ids = HashSet::new();
        let input_dir = RootPath::new(input_path);
        config.execution.load(&input_dir)?;
        if let Some(network) = &mut config.validator_network {
            network.load(RoleType::Validator)?;
            network_ids.insert(network.network_id.clone());
        }
        for network in &mut config.full_node_networks {
            network.load(RoleType::FullNode)?;
            // Validate that a network isn't repeated
            let network_id = network.network_id.clone();
            invariant(
                !network_ids.contains(&network_id),
                format!("network_id {:?} was repeated", network_id),
            )?;
            network_ids.insert(network_id);
        }
        config.set_data_dir(config.data_dir().clone());
        Ok(config)
    }
pub fn load < P : AsRef < Path > > ( input_path : P ) -> Result < Self , Error > { let mut config = Self :: load_config ( & input_path ) ? ; if config . base . role . is_validator ( ) { invariant ( config . validator_network . is_some ( ) , " " . into ( ) , ) ? ; } else { invariant ( config . validator_network . is_none ( ) , " " . into ( ) , ) ? ; } let mut network_ids = HashSet :: new ( ) ; let input_dir = RootPath :: new ( input_path ) ; config . execution . load ( & input_dir ) ? ; if let Some ( network ) = & mut config . validator_network { network . load ( RoleType :: Validator ) ? ; network_ids . insert ( network . network_id . clone ( ) ) ; } for network in & mut config . full_node_networks { network . load ( RoleType :: FullNode ) ? ; // Validate that a network isn't repeated let network_id = network . network_id . clone ( ) ; invariant ( ! network_ids . contains ( & network_id ) , format ! ( " " network_id ) , ) ? ; network_ids . insert ( network_id ) ; } config . set_data_dir ( config . data_dir ( ) . clone ( ) ) ; Ok ( config ) }
Reads the config file and returns the configuration object in addition to doing some
post-processing of the config
Paths used in the config are either absolute or relative to the config location
Reads the config file and returns the configuration object in addition to doing some post - processing of the config Paths used in the config are either absolute or relative to the config location
input_path
P
input_path
P