/// Determines if the system should be put in genesis mode
///
/// Returns:
///      bool: return whether or not a genesis block is required to be created
///
/// Returns error if there is invalid combination of the following: genesis.batch, existing
/// chain head, and block chain id.
Determines if the system should be put in genesis mode
Returns:
bool: return whether or not a genesis block is required to be created

Returns error if there is invalid combination of the following: genesis.batch, existing
chain head, and block chain id.
Determines if the system should be put in genesis mode Returns : bool : return whether or not a genesis block is required to be created Returns error if there is invalid combination of the following : genesis . batch existing chain head and block chain id .
pub fn requires_genesis(&self) -> Result<bool, GenesisError> {
        // check if the genesis batch file exists
        let genesis_path = self.genesis_file_path.as_path();
        if genesis_path.is_file() {
            debug!("Genesis batch file: {}", self.genesis_file_path.display());
        } else {
            debug!("Genesis batch file: not found");
        }
        // check if there is a chain head
        let chain_head = self.chain_reader.chain_head().map_err(|err| {
            GenesisError::InvalidGenesisState(format!("Unable to read chain head: {}", err))
        })?;
        if let Some(ref chain_head_inner) = chain_head {
            if genesis_path.is_file() {
                return Err(GenesisError::InvalidGenesisState(format!(
                    "Cannot have a genesis batch file and an existing chain (chain head: {})",
                    chain_head_inner.block().header_signature()
                )));
            }
        }
        // check if there is a block chain id
        let block_chain_id = self.chain_id_manager.get_block_chain_id().map_err(|err| {
            GenesisError::InvalidGenesisState(format!("Unable to read block chain id: {}", err))
        })?;
        if let Some(ref block_chain_id_inner) = block_chain_id {
            if genesis_path.is_file() {
                return Err(GenesisError::InvalidGenesisState(format!(
                    "Cannot have a genesis batch file and join an existing network (chain_id: {})",
                    block_chain_id_inner
                )));
            }
        };
        if !genesis_path.is_file() && chain_head.is_none() {
            info!("No chain head and not the genesis node: starting in peering mode")
        }
        Ok(genesis_path.is_file() && chain_head.is_none() && block_chain_id.is_none())
    }
pub fn requires_genesis ( & self ) -> Result < bool , GenesisError > { // check if the genesis batch file exists let genesis_path = self . genesis_file_path . as_path ( ) ; if genesis_path . is_file ( ) { debug ! ( " " self genesis_file_path display ( ) ) ; } else { debug ! ( " " ) ; } // check if there is a chain head let chain_head = self . chain_reader . chain_head ( ) . map_err ( | err | { GenesisError :: InvalidGenesisState ( format ! ( " " err ) ) } ) ? ; if let Some ( ref chain_head_inner ) = chain_head { if genesis_path . is_file ( ) { return Err ( GenesisError :: InvalidGenesisState ( format ! ( " " chain_head_inner block ( ) header_signature ( ) ) ) ) ; } } // check if there is a block chain id let block_chain_id = self . chain_id_manager . get_block_chain_id ( ) . map_err ( | err | { GenesisError :: InvalidGenesisState ( format ! ( " " err ) ) } ) ? ; if let Some ( ref block_chain_id_inner ) = block_chain_id { if genesis_path . is_file ( ) { return Err ( GenesisError :: InvalidGenesisState ( format ! ( " " block_chain_id_inner ) ) ) ; } } ; if ! genesis_path . is_file ( ) && chain_head . is_none ( ) { info ! ( " " ) } Ok ( genesis_path . is_file ( ) && chain_head . is_none ( ) && block_chain_id . is_none ( ) ) }
Determines if the system should be put in genesis mode
Returns:
bool: return whether or not a genesis block is required to be created
Determines if the system should be put in genesis mode Returns : bool : return whether or not a genesis block is required to be created
&self