Refactor genesis download/load/check functions (#17276)

* Refactor genesis ingest functions

* Consolidate genesis.bin/genesis.tar.bz2 references
This commit is contained in:
sakridge
2021-05-24 16:45:36 +02:00
committed by GitHub
parent 9d112cf41f
commit a8dca3976b
11 changed files with 158 additions and 100 deletions

View File

@ -32,6 +32,10 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
pub const DEFAULT_GENESIS_FILE: &str = "genesis.bin";
pub const DEFAULT_GENESIS_ARCHIVE: &str = "genesis.tar.bz2";
pub const DEFAULT_GENESIS_DOWNLOAD_PATH: &str = "/genesis.tar.bz2";
// deprecated default that is no longer used
pub const UNUSED_DEFAULT: u64 = 1024;
@ -152,7 +156,7 @@ impl GenesisConfig {
}
fn genesis_filename(ledger_path: &Path) -> PathBuf {
Path::new(ledger_path).join("genesis.bin")
Path::new(ledger_path).join(DEFAULT_GENESIS_FILE)
}
pub fn load(ledger_path: &Path) -> Result<Self, std::io::Error> {