Skip to content

Commit

Permalink
Add --process-ledger-before-service flag to solana-validator
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Sep 11, 2022
1 parent d36c577 commit 83d4d12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub struct ValidatorConfig {
pub no_os_disk_stats_reporting: bool,
pub poh_pinned_cpu_core: usize,
pub poh_hashes_per_batch: u64,
pub process_ledger_before_services: bool,
pub account_indexes: AccountSecondaryIndexes,
pub accounts_db_caching_enabled: bool,
pub accounts_db_config: Option<AccountsDbConfig>,
Expand Down Expand Up @@ -226,6 +227,7 @@ impl Default for ValidatorConfig {
no_os_disk_stats_reporting: true,
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
process_ledger_before_services: false,
account_indexes: AccountSecondaryIndexes::default(),
accounts_db_caching_enabled: false,
warp_slot: None,
Expand Down Expand Up @@ -671,6 +673,9 @@ impl Validator {
&leader_schedule_cache,
)?;

if config.process_ledger_before_services {
process_blockstore.process()?;
}
*start_progress.write().unwrap() = ValidatorStartProgress::StartingServices;

let sample_performance_service =
Expand Down
1 change: 1 addition & 0 deletions local-cluster/src/validator_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
staked_nodes_overrides: config.staked_nodes_overrides.clone(),
validator_exit: Arc::new(RwLock::new(Exit::default())),
poh_hashes_per_batch: config.poh_hashes_per_batch,
process_ledger_before_services: config.process_ledger_before_services,
no_wait_for_vote_to_start_leader: config.no_wait_for_vote_to_start_leader,
accounts_shrink_ratio: config.accounts_shrink_ratio,
accounts_db_config: config.accounts_db_config.clone(),
Expand Down
7 changes: 7 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,12 @@ pub fn main() {
.value_name("NUM")
.help("Specify hashes per batch in PoH service"),
)
.arg(
Arg::with_name("process_ledger_before_services")
.long("process-ledger-before-services")
.hidden(true)
.help("Process the local ledger fully before starting networking services")
)
.arg(
Arg::with_name("account_indexes")
.long("account-index")
Expand Down Expand Up @@ -2789,6 +2795,7 @@ pub fn main() {
.unwrap_or(poh_service::DEFAULT_PINNED_CPU_CORE),
poh_hashes_per_batch: value_of(&matches, "poh_hashes_per_batch")
.unwrap_or(poh_service::DEFAULT_HASHES_PER_BATCH),
process_ledger_before_services: matches.is_present("process_ledger_before_services"),
account_indexes,
accounts_db_caching_enabled: !matches.is_present("no_accounts_db_caching"),
accounts_db_test_hash_calculation: matches.is_present("accounts_db_test_hash_calculation"),
Expand Down

0 comments on commit 83d4d12

Please sign in to comment.