Extract tower storage details from Tower struct
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
use solana_client::thin_client::ThinClient;
|
||||
use solana_core::validator::Validator;
|
||||
use solana_core::validator::ValidatorConfig;
|
||||
use solana_gossip::{cluster_info::Node, contact_info::ContactInfo};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::Keypair;
|
||||
use solana_streamer::socket::SocketAddrSpace;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use {
|
||||
solana_client::thin_client::ThinClient,
|
||||
solana_core::validator::{Validator, ValidatorConfig},
|
||||
solana_gossip::{cluster_info::Node, contact_info::ContactInfo},
|
||||
solana_sdk::{pubkey::Pubkey, signature::Keypair},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::{path::PathBuf, sync::Arc},
|
||||
};
|
||||
|
||||
pub struct ValidatorInfo {
|
||||
pub keypair: Arc<Keypair>,
|
||||
|
@ -1,55 +1,59 @@
|
||||
use crate::{
|
||||
cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo},
|
||||
cluster_tests,
|
||||
validator_configs::*,
|
||||
};
|
||||
use itertools::izip;
|
||||
use log::*;
|
||||
use solana_client::thin_client::{create_client, ThinClient};
|
||||
use solana_core::validator::{Validator, ValidatorConfig, ValidatorStartProgress};
|
||||
use solana_gossip::{
|
||||
cluster_info::{Node, VALIDATOR_PORT_RANGE},
|
||||
contact_info::ContactInfo,
|
||||
gossip_service::discover_cluster,
|
||||
};
|
||||
use solana_ledger::create_new_tmp_ledger;
|
||||
use solana_runtime::genesis_utils::{
|
||||
create_genesis_config_with_vote_accounts_and_cluster_type, GenesisConfigInfo,
|
||||
ValidatorVoteKeypairs,
|
||||
};
|
||||
use solana_sdk::{
|
||||
account::Account,
|
||||
account::AccountSharedData,
|
||||
client::SyncClient,
|
||||
clock::{DEFAULT_DEV_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT},
|
||||
commitment_config::CommitmentConfig,
|
||||
epoch_schedule::EpochSchedule,
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
message::Message,
|
||||
poh_config::PohConfig,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
stake::{
|
||||
config as stake_config, instruction as stake_instruction,
|
||||
state::{Authorized, Lockup},
|
||||
use {
|
||||
crate::{
|
||||
cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo},
|
||||
cluster_tests,
|
||||
validator_configs::*,
|
||||
},
|
||||
itertools::izip,
|
||||
log::*,
|
||||
solana_client::thin_client::{create_client, ThinClient},
|
||||
solana_core::{
|
||||
consensus::FileTowerStorage,
|
||||
validator::{Validator, ValidatorConfig, ValidatorStartProgress},
|
||||
},
|
||||
solana_gossip::{
|
||||
cluster_info::{Node, VALIDATOR_PORT_RANGE},
|
||||
contact_info::ContactInfo,
|
||||
gossip_service::discover_cluster,
|
||||
},
|
||||
solana_ledger::create_new_tmp_ledger,
|
||||
solana_runtime::genesis_utils::{
|
||||
create_genesis_config_with_vote_accounts_and_cluster_type, GenesisConfigInfo,
|
||||
ValidatorVoteKeypairs,
|
||||
},
|
||||
solana_sdk::{
|
||||
account::Account,
|
||||
account::AccountSharedData,
|
||||
client::SyncClient,
|
||||
clock::{DEFAULT_DEV_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT},
|
||||
commitment_config::CommitmentConfig,
|
||||
epoch_schedule::EpochSchedule,
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
message::Message,
|
||||
poh_config::PohConfig,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
stake::{
|
||||
config as stake_config, instruction as stake_instruction,
|
||||
state::{Authorized, Lockup},
|
||||
},
|
||||
system_transaction,
|
||||
transaction::Transaction,
|
||||
},
|
||||
solana_stake_program::{config::create_account as create_stake_config_account, stake_state},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
solana_vote_program::{
|
||||
vote_instruction,
|
||||
vote_state::{VoteInit, VoteState},
|
||||
},
|
||||
std::{
|
||||
collections::HashMap,
|
||||
io::{Error, ErrorKind, Result},
|
||||
iter,
|
||||
sync::{Arc, RwLock},
|
||||
},
|
||||
system_transaction,
|
||||
transaction::Transaction,
|
||||
};
|
||||
use solana_stake_program::{config::create_account as create_stake_config_account, stake_state};
|
||||
use solana_streamer::socket::SocketAddrSpace;
|
||||
use solana_vote_program::{
|
||||
vote_instruction,
|
||||
vote_state::{VoteInit, VoteState},
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
io::{Error, ErrorKind, Result},
|
||||
iter,
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ClusterConfig {
|
||||
/// The validator config that should be applied to every node in the cluster
|
||||
pub validator_configs: Vec<ValidatorConfig>,
|
||||
@ -207,6 +211,7 @@ impl LocalCluster {
|
||||
let mut leader_config = safe_clone_config(&config.validator_configs[0]);
|
||||
leader_config.rpc_addrs = Some((leader_node.info.rpc, leader_node.info.rpc_pubsub));
|
||||
leader_config.account_paths = vec![leader_ledger_path.join("accounts")];
|
||||
leader_config.tower_storage = Arc::new(FileTowerStorage::new(leader_ledger_path.clone()));
|
||||
let leader_keypair = Arc::new(Keypair::from_bytes(&leader_keypair.to_bytes()).unwrap());
|
||||
let leader_vote_keypair =
|
||||
Arc::new(Keypair::from_bytes(&leader_vote_keypair.to_bytes()).unwrap());
|
||||
@ -367,6 +372,7 @@ impl LocalCluster {
|
||||
let mut config = safe_clone_config(validator_config);
|
||||
config.rpc_addrs = Some((validator_node.info.rpc, validator_node.info.rpc_pubsub));
|
||||
config.account_paths = vec![ledger_path.join("accounts")];
|
||||
config.tower_storage = Arc::new(FileTowerStorage::new(ledger_path.clone()));
|
||||
let voting_keypair = voting_keypair.unwrap();
|
||||
let validator_server = Validator::new(
|
||||
validator_node,
|
||||
@ -704,6 +710,8 @@ impl Cluster for LocalCluster {
|
||||
let validator_info = &cluster_validator_info.info;
|
||||
cluster_validator_info.config.account_paths =
|
||||
vec![validator_info.ledger_path.join("accounts")];
|
||||
cluster_validator_info.config.tower_storage =
|
||||
Arc::new(FileTowerStorage::new(validator_info.ledger_path.clone()));
|
||||
let restarted_node = Validator::new(
|
||||
node,
|
||||
validator_info.keypair.clone(),
|
||||
|
@ -37,7 +37,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
|
||||
wal_recovery_mode: config.wal_recovery_mode.clone(),
|
||||
poh_verify: config.poh_verify,
|
||||
require_tower: config.require_tower,
|
||||
tower_path: config.tower_path.clone(),
|
||||
tower_storage: config.tower_storage.clone(),
|
||||
debug_keys: config.debug_keys.clone(),
|
||||
contact_debug_interval: config.contact_debug_interval,
|
||||
contact_save_interval: config.contact_save_interval,
|
||||
|
Reference in New Issue
Block a user