solana-test-validator now uses FileTowerStorage
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use {
|
||||
crate::validator::{Validator, ValidatorConfig, ValidatorStartProgress},
|
||||
crate::{
|
||||
tower_storage::TowerStorage,
|
||||
validator::{Validator, ValidatorConfig, ValidatorStartProgress},
|
||||
},
|
||||
solana_client::rpc_client::RpcClient,
|
||||
solana_gossip::{
|
||||
cluster_info::{ClusterInfo, Node},
|
||||
@@ -76,6 +79,7 @@ impl Default for TestValidatorNodeConfig {
|
||||
pub struct TestValidatorGenesis {
|
||||
fee_rate_governor: FeeRateGovernor,
|
||||
ledger_path: Option<PathBuf>,
|
||||
tower_storage: Option<Arc<dyn TowerStorage>>,
|
||||
pub rent: Rent,
|
||||
rpc_config: JsonRpcConfig,
|
||||
rpc_ports: Option<(u16, u16)>, // (JsonRpc, JsonRpcPubSub), None == random ports
|
||||
@@ -97,6 +101,11 @@ impl TestValidatorGenesis {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn tower_storage(&mut self, tower_storage: Arc<dyn TowerStorage>) -> &mut Self {
|
||||
self.tower_storage = Some(tower_storage);
|
||||
self
|
||||
}
|
||||
|
||||
/// Check if a given TestValidator ledger has already been initialized
|
||||
pub fn ledger_exists(ledger_path: &Path) -> bool {
|
||||
ledger_path.join("vote-account-keypair.json").exists()
|
||||
@@ -484,7 +493,7 @@ impl TestValidator {
|
||||
}
|
||||
}
|
||||
|
||||
let validator_config = ValidatorConfig {
|
||||
let mut validator_config = ValidatorConfig {
|
||||
rpc_addrs: Some((
|
||||
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), node.info.rpc.port()),
|
||||
SocketAddr::new(
|
||||
@@ -514,6 +523,9 @@ impl TestValidator {
|
||||
no_wait_for_vote_to_start_leader: true,
|
||||
..ValidatorConfig::default()
|
||||
};
|
||||
if let Some(ref tower_storage) = config.tower_storage {
|
||||
validator_config.tower_storage = tower_storage.clone();
|
||||
}
|
||||
|
||||
let validator = Some(Validator::new(
|
||||
node,
|
||||
|
||||
Reference in New Issue
Block a user