Extract tower storage details from Tower struct
This commit is contained in:
@@ -5,7 +5,10 @@ use {
|
||||
jsonrpc_ipc_server::{RequestContext, ServerBuilder},
|
||||
jsonrpc_server_utils::tokio,
|
||||
log::*,
|
||||
solana_core::validator::ValidatorStartProgress,
|
||||
solana_core::{
|
||||
consensus::{Tower, TowerStorage},
|
||||
validator::ValidatorStartProgress,
|
||||
},
|
||||
solana_gossip::cluster_info::ClusterInfo,
|
||||
solana_sdk::{
|
||||
exit::Exit,
|
||||
@@ -13,7 +16,7 @@ use {
|
||||
},
|
||||
std::{
|
||||
net::SocketAddr,
|
||||
path::{Path, PathBuf},
|
||||
path::Path,
|
||||
sync::{Arc, RwLock},
|
||||
thread::{self, Builder},
|
||||
time::{Duration, SystemTime},
|
||||
@@ -28,7 +31,7 @@ pub struct AdminRpcRequestMetadata {
|
||||
pub validator_exit: Arc<RwLock<Exit>>,
|
||||
pub authorized_voter_keypairs: Arc<RwLock<Vec<Arc<Keypair>>>>,
|
||||
pub cluster_info: Arc<RwLock<Option<Arc<ClusterInfo>>>>,
|
||||
pub tower_path: PathBuf,
|
||||
pub tower_storage: Arc<dyn TowerStorage>,
|
||||
}
|
||||
impl Metadata for AdminRpcRequestMetadata {}
|
||||
|
||||
@@ -147,13 +150,12 @@ impl AdminRpc for AdminRpcImpl {
|
||||
|
||||
// Ensure a Tower exists for the new identity and exit gracefully.
|
||||
// ReplayStage will be less forgiving if it fails to load the new tower.
|
||||
solana_core::consensus::Tower::restore(&meta.tower_path, &identity_keypair.pubkey())
|
||||
.map_err(|err| {
|
||||
jsonrpc_core::error::Error::invalid_params(format!(
|
||||
"Unable to load tower file for new identity: {}",
|
||||
err
|
||||
))
|
||||
})?;
|
||||
Tower::restore(meta.tower_storage.as_ref(), &identity_keypair.pubkey()).map_err(|err| {
|
||||
jsonrpc_core::error::Error::invalid_params(format!(
|
||||
"Unable to load tower file for new identity: {}",
|
||||
err
|
||||
))
|
||||
})?;
|
||||
|
||||
if let Some(cluster_info) = meta.cluster_info.read().unwrap().as_ref() {
|
||||
solana_metrics::set_host_id(identity_keypair.pubkey().to_string());
|
||||
|
Reference in New Issue
Block a user