Add flag to disable prune on startup

This commit is contained in:
Michael Sproul
2022-09-12 11:41:45 +10:00
parent de775d6aa5
commit b28e8d0848
5 changed files with 34 additions and 3 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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
*

View File

@@ -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,
}
}
}