mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 11:22:56 +00:00
Add lighthouse db command!
This commit is contained in:
@@ -255,16 +255,7 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.freezer_db_path = Some(PathBuf::from(freezer_dir));
|
||||
}
|
||||
|
||||
if let Some(slots_per_restore_point) = cli_args.value_of("slots-per-restore-point") {
|
||||
client_config.store.slots_per_restore_point = slots_per_restore_point
|
||||
.parse()
|
||||
.map_err(|_| "slots-per-restore-point is not a valid integer".to_string())?;
|
||||
} else {
|
||||
client_config.store.slots_per_restore_point = std::cmp::min(
|
||||
E::slots_per_historical_root() as u64,
|
||||
store::config::DEFAULT_SLOTS_PER_RESTORE_POINT,
|
||||
);
|
||||
}
|
||||
client_config.store.slots_per_restore_point = get_slots_per_restore_point::<E>(cli_args)?;
|
||||
|
||||
if let Some(block_cache_size) = clap_utils::parse_optional(cli_args, "block-cache-size")? {
|
||||
client_config.store.block_cache_size = block_cache_size;
|
||||
@@ -791,3 +782,17 @@ pub fn get_data_dir(cli_args: &ArgMatches) -> PathBuf {
|
||||
})
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
}
|
||||
|
||||
/// Get the `slots_per_restore_point` value to use for the database.
|
||||
pub fn get_slots_per_restore_point<E: EthSpec>(cli_args: &ArgMatches) -> Result<u64, String> {
|
||||
if let Some(slots_per_restore_point) =
|
||||
clap_utils::parse_optional(cli_args, "slots-per-restore-point")?
|
||||
{
|
||||
Ok(slots_per_restore_point)
|
||||
} else {
|
||||
Ok(std::cmp::min(
|
||||
E::slots_per_historical_root() as u64,
|
||||
store::config::DEFAULT_SLOTS_PER_RESTORE_POINT,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use beacon_chain::{
|
||||
use clap::ArgMatches;
|
||||
pub use cli::cli_app;
|
||||
pub use client::{Client, ClientBuilder, ClientConfig, ClientGenesis};
|
||||
pub use config::{get_config, get_data_dir, set_network_config};
|
||||
pub use config::{get_config, get_data_dir, get_slots_per_restore_point, set_network_config};
|
||||
use environment::RuntimeContext;
|
||||
pub use eth2_config::Eth2Config;
|
||||
use slasher::Slasher;
|
||||
|
||||
Reference in New Issue
Block a user