mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 13:58:28 +00:00
Add flag to disable prune on startup
This commit is contained in:
@@ -267,9 +267,11 @@ where
|
||||
self.genesis_time = Some(genesis_state.genesis_time());
|
||||
|
||||
// Prune finalized execution payloads.
|
||||
store
|
||||
.try_prune_execution_payloads(false)
|
||||
.map_err(|e| format!("Error pruning execution payloads: {e:?}"))?;
|
||||
if store.get_config().prune_payloads_on_init {
|
||||
store
|
||||
.try_prune_execution_payloads(false)
|
||||
.map_err(|e| format!("Error pruning execution payloads: {e:?}"))?;
|
||||
}
|
||||
|
||||
self.op_pool = Some(
|
||||
store
|
||||
|
||||
@@ -515,6 +515,13 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.takes_value(true)
|
||||
.default_value("true")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("prune-payloads-on-startup")
|
||||
.long("prune-payloads-on-startup")
|
||||
.help("Check for execution payloads to prune on start-up.")
|
||||
.takes_value(true)
|
||||
.default_value("true")
|
||||
)
|
||||
|
||||
/*
|
||||
* Misc.
|
||||
|
||||
@@ -358,6 +358,12 @@ pub fn get_config<E: EthSpec>(
|
||||
.map_err(|_| "auto-compact-db takes a boolean".to_string())?;
|
||||
}
|
||||
|
||||
if let Some(prune_payloads_on_init) =
|
||||
clap_utils::parse_optional(cli_args, "prune-payloads-on-startup")?
|
||||
{
|
||||
client_config.store.prune_payloads_on_init = prune_payloads_on_init;
|
||||
}
|
||||
|
||||
/*
|
||||
* Zero-ports
|
||||
*
|
||||
|
||||
@@ -21,6 +21,8 @@ pub struct StoreConfig {
|
||||
pub compact_on_init: bool,
|
||||
/// Whether to compact the database during database pruning.
|
||||
pub compact_on_prune: bool,
|
||||
/// Whether to try pruning execution payloads on initialization.
|
||||
pub prune_payloads_on_init: bool,
|
||||
}
|
||||
|
||||
/// Variant of `StoreConfig` that gets written to disk. Contains immutable configuration params.
|
||||
@@ -43,6 +45,7 @@ impl Default for StoreConfig {
|
||||
block_cache_size: DEFAULT_BLOCK_CACHE_SIZE,
|
||||
compact_on_init: false,
|
||||
compact_on_prune: true,
|
||||
prune_payloads_on_init: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user