fn compute_genesis(
    genesis_path: &PathBuf,
    db_path: &Path,
) -> Result<(DbReaderWriter, Waypoint), Error> {
    let libradb =
        LibraDB::open(db_path, false, None).map_err(|e| Error::UnexpectedError(e.to_string()))?;
    let db_rw = DbReaderWriter::new(libradb);

    let mut file = File::open(genesis_path)
        .map_err(|e| Error::UnexpectedError(format!("Unable to open genesis file: {}", e)))?;
    let mut buffer = vec![];
    file.read_to_end(&mut buffer)
        .map_err(|e| Error::UnexpectedError(format!("Unable to read genesis: {}", e)))?;
    let genesis = lcs::from_bytes(&buffer)
        .map_err(|e| Error::UnexpectedError(format!("Unable to parse genesis: {}", e)))?;

    let waypoint = db_bootstrapper::bootstrap_db_if_empty::<LibraVM>(&db_rw, &genesis)
        .map_err(|e| Error::UnexpectedError(e.to_string()))?
        .ok_or_else(|| Error::UnexpectedError("Unable to generate a waypoint".to_string()))?;

    Ok((db_rw, waypoint))
}
/// Compute the ledger given a genesis writeset transaction and return access to that ledger and
/// the waypoint for that state.
Compute the ledger given a genesis writeset transaction and return access to that ledger and
the waypoint for that state.
Compute the ledger given a genesis writeset transaction and return access to that ledger and the waypoint for that state .
fn compute_genesis(
    genesis_path: &PathBuf,
    db_path: &Path,
) -> Result<(DbReaderWriter, Waypoint), Error> {
    let libradb =
        LibraDB::open(db_path, false, None).map_err(|e| Error::UnexpectedError(e.to_string()))?;
    let db_rw = DbReaderWriter::new(libradb);
    let mut file = File::open(genesis_path)
        .map_err(|e| Error::UnexpectedError(format!("Unable to open genesis file: {}", e)))?;
    let mut buffer = vec![];
    file.read_to_end(&mut buffer)
        .map_err(|e| Error::UnexpectedError(format!("Unable to read genesis: {}", e)))?;
    let genesis = lcs::from_bytes(&buffer)
        .map_err(|e| Error::UnexpectedError(format!("Unable to parse genesis: {}", e)))?;
    let waypoint = db_bootstrapper::bootstrap_db_if_empty::<LibraVM>(&db_rw, &genesis)
        .map_err(|e| Error::UnexpectedError(e.to_string()))?
        .ok_or_else(|| Error::UnexpectedError("Unable to generate a waypoint".to_string()))?;
    Ok((db_rw, waypoint))
}
fn compute_genesis ( genesis_path : & PathBuf , db_path : & Path , ) -> Result < ( DbReaderWriter , Waypoint ) , Error > { let libradb = LibraDB :: open ( db_path , false , None ) . map_err ( | e | Error :: UnexpectedError ( e . to_string ( ) ) ) ? ; let db_rw = DbReaderWriter :: new ( libradb ) ; let mut file = File :: open ( genesis_path ) . map_err ( | e | Error :: UnexpectedError ( format ! ( " " e ) ) ) ? ; let mut buffer = vec ! [ ] ; file . read_to_end ( & mut buffer ) . map_err ( | e | Error :: UnexpectedError ( format ! ( " " e ) ) ) ? ; let genesis = lcs :: from_bytes ( & buffer ) . map_err ( | e | Error :: UnexpectedError ( format ! ( " " e ) ) ) ? ; let waypoint = db_bootstrapper :: bootstrap_db_if_empty :: < LibraVM > ( & db_rw , & genesis ) . map_err ( | e | Error :: UnexpectedError ( e . to_string ( ) ) ) ? . ok_or_else ( | | Error :: UnexpectedError ( " " . to_string ( ) ) ) ? ; Ok ( ( db_rw , waypoint ) ) }
Compute the ledger given a genesis writeset transaction and return access to that ledger and
the waypoint for that state.
Compute the ledger given a genesis writeset transaction and return access to that ledger and the waypoint for that state .
genesis_path
&PathBuf
db_path
&Path
genesis_path
&PathBuf
db_path
&Path