Add ability to change the validator identity at runtime

This commit is contained in:
Michael Vines
2021-06-17 13:51:06 -07:00
parent bf157506e8
commit b6792a3328
14 changed files with 223 additions and 93 deletions

View File

@@ -260,6 +260,7 @@ pub struct Validator {
tpu: Tpu,
tvu: Tvu,
ip_echo_server: Option<solana_net_utils::IpEchoServer>,
pub cluster_info: Arc<ClusterInfo>,
}
// in the distant future, get rid of ::new()/exit() and use Result properly...
@@ -279,7 +280,7 @@ pub(crate) fn abort() -> ! {
impl Validator {
pub fn new(
mut node: Node,
identity_keypair: &Arc<Keypair>,
identity_keypair: Arc<Keypair>,
ledger_path: &Path,
vote_account: &Pubkey,
authorized_voter_keypairs: Arc<RwLock<Vec<Arc<Keypair>>>>,
@@ -437,7 +438,7 @@ impl Validator {
}
}
let mut cluster_info = ClusterInfo::new(node.info.clone(), identity_keypair.clone());
let mut cluster_info = ClusterInfo::new(node.info.clone(), identity_keypair);
cluster_info.set_contact_debug_interval(config.contact_debug_interval);
cluster_info.set_entrypoints(cluster_entrypoints);
cluster_info.restore_contact_info(ledger_path, config.contact_save_interval);
@@ -790,6 +791,7 @@ impl Validator {
poh_recorder,
ip_echo_server,
validator_exit: config.validator_exit.clone(),
cluster_info,
}
}
@@ -829,6 +831,8 @@ impl Validator {
}
pub fn join(self) {
drop(self.cluster_info);
self.poh_service.join().expect("poh_service");
drop(self.poh_recorder);
@@ -1628,7 +1632,7 @@ mod tests {
let start_progress = Arc::new(RwLock::new(ValidatorStartProgress::default()));
let validator = Validator::new(
validator_node,
&Arc::new(validator_keypair),
Arc::new(validator_keypair),
&validator_ledger_path,
&voting_keypair.pubkey(),
Arc::new(RwLock::new(vec![voting_keypair.clone()])),
@@ -1706,7 +1710,7 @@ mod tests {
};
Validator::new(
validator_node,
&Arc::new(validator_keypair),
Arc::new(validator_keypair),
&validator_ledger_path,
&vote_account_keypair.pubkey(),
Arc::new(RwLock::new(vec![Arc::new(vote_account_keypair)])),