started_from_validator, ignore env var for cli (#23309)
This commit is contained in:
parent
cafc18c3f9
commit
99a057927c
|
@ -16,7 +16,8 @@ use {
|
||||||
solana_net_utils::PortRange,
|
solana_net_utils::PortRange,
|
||||||
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
bank_forks::BankForks, genesis_utils::create_genesis_config_with_leader_ex,
|
accounts_db::AccountsDbConfig, accounts_index::AccountsIndexConfig, bank_forks::BankForks,
|
||||||
|
genesis_utils::create_genesis_config_with_leader_ex,
|
||||||
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, snapshot_config::SnapshotConfig,
|
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, snapshot_config::SnapshotConfig,
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
|
@ -108,6 +109,7 @@ pub struct TestValidatorGenesis {
|
||||||
pub accountsdb_plugin_config_files: Option<Vec<PathBuf>>,
|
pub accountsdb_plugin_config_files: Option<Vec<PathBuf>>,
|
||||||
pub accounts_db_caching_enabled: bool,
|
pub accounts_db_caching_enabled: bool,
|
||||||
deactivate_feature_set: HashSet<Pubkey>,
|
deactivate_feature_set: HashSet<Pubkey>,
|
||||||
|
pub started_from_validator: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TestValidatorGenesis {
|
impl Default for TestValidatorGenesis {
|
||||||
|
@ -135,6 +137,7 @@ impl Default for TestValidatorGenesis {
|
||||||
accountsdb_plugin_config_files: Option::<Vec<PathBuf>>::default(),
|
accountsdb_plugin_config_files: Option::<Vec<PathBuf>>::default(),
|
||||||
accounts_db_caching_enabled: bool::default(),
|
accounts_db_caching_enabled: bool::default(),
|
||||||
deactivate_feature_set: HashSet::<Pubkey>::default(),
|
deactivate_feature_set: HashSet::<Pubkey>::default(),
|
||||||
|
started_from_validator: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,6 +658,18 @@ impl TestValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let accounts_db_config = if config.started_from_validator {
|
||||||
|
Some(AccountsDbConfig {
|
||||||
|
index: Some(AccountsIndexConfig {
|
||||||
|
started_from_validator: config.started_from_validator,
|
||||||
|
..AccountsIndexConfig::default()
|
||||||
|
}),
|
||||||
|
..AccountsDbConfig::default()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut validator_config = ValidatorConfig {
|
let mut validator_config = ValidatorConfig {
|
||||||
accountsdb_plugin_config_files: config.accountsdb_plugin_config_files.clone(),
|
accountsdb_plugin_config_files: config.accountsdb_plugin_config_files.clone(),
|
||||||
accounts_db_caching_enabled: config.accounts_db_caching_enabled,
|
accounts_db_caching_enabled: config.accounts_db_caching_enabled,
|
||||||
|
@ -684,6 +699,7 @@ impl TestValidator {
|
||||||
rocksdb_compaction_interval: Some(100), // Compact every 100 slots
|
rocksdb_compaction_interval: Some(100), // Compact every 100 slots
|
||||||
max_ledger_shreds: config.max_ledger_shreds,
|
max_ledger_shreds: config.max_ledger_shreds,
|
||||||
no_wait_for_vote_to_start_leader: true,
|
no_wait_for_vote_to_start_leader: true,
|
||||||
|
accounts_db_config,
|
||||||
..ValidatorConfig::default_for_test()
|
..ValidatorConfig::default_for_test()
|
||||||
};
|
};
|
||||||
if let Some(ref tower_storage) = config.tower_storage {
|
if let Some(ref tower_storage) = config.tower_storage {
|
||||||
|
|
|
@ -582,6 +582,8 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut genesis = TestValidatorGenesis::default();
|
let mut genesis = TestValidatorGenesis::default();
|
||||||
|
// this startup path should act like we started from a validator
|
||||||
|
genesis.started_from_validator = true;
|
||||||
genesis.max_ledger_shreds = value_of(&matches, "limit_ledger_size");
|
genesis.max_ledger_shreds = value_of(&matches, "limit_ledger_size");
|
||||||
genesis.max_genesis_archive_unpacked_size = Some(u64::MAX);
|
genesis.max_genesis_archive_unpacked_size = Some(u64::MAX);
|
||||||
genesis.accounts_db_caching_enabled = !matches.is_present("no_accounts_db_caching");
|
genesis.accounts_db_caching_enabled = !matches.is_present("no_accounts_db_caching");
|
||||||
|
|
Loading…
Reference in New Issue