Skip to content

Commit

Permalink
Fix stale gossip entrypoint (solana-labs#8053)
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin authored Jan 31, 2020
1 parent 2226c1b commit fd207b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions local-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl ClusterValidatorInfo {
pub trait Cluster {
fn get_node_pubkeys(&self) -> Vec<Pubkey>;
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient>;
fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo>;
fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo;
fn restart_node(&mut self, pubkey: &Pubkey, cluster_validator_info: ClusterValidatorInfo);
fn exit_restart_node(&mut self, pubkey: &Pubkey, config: ValidatorConfig);
Expand Down
4 changes: 4 additions & 0 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ impl Cluster for LocalCluster {
cluster_validator_info.config = validator_config;
self.restart_node(pubkey, cluster_validator_info);
}

fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo> {
self.validators.get(pubkey).map(|v| &v.info.contact_info)
}
}

impl Drop for LocalCluster {
Expand Down
5 changes: 4 additions & 1 deletion local-cluster/tests/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,11 @@ fn test_snapshot_restart_tower() {
cluster.restart_node(&validator_id, validator_info);

// Test cluster can still make progress and get confirmations in tower
// Use the restarted node as the discovery point so that we get updated
// validator's ContactInfo
let restarted_node_info = cluster.get_contact_info(&validator_id).unwrap();
cluster_tests::spend_and_verify_all_nodes(
&cluster.entry_point_info,
&restarted_node_info,
&cluster.funding_keypair,
1,
HashSet::new(),
Expand Down

0 comments on commit fd207b6

Please sign in to comment.