Fix local-cluster for QUIC more (#27096)

This commit is contained in:
Tyera Eulberg 2022-08-12 06:20:04 -07:00 committed by GitHub
parent 02a6b7ac1f
commit 1aa8e06fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ use {
},
};
fn get_client_facing_addr(contact_info: &ContactInfo) -> (SocketAddr, SocketAddr) {
pub fn get_client_facing_addr(contact_info: &ContactInfo) -> (SocketAddr, SocketAddr) {
let (rpc, mut tpu) = contact_info.client_facing_addr();
// QUIC certificate authentication requires the IP Address to match. ContactInfo might have
// 0.0.0.0 as the IP instead of 127.0.0.1.

View File

@ -425,7 +425,7 @@ impl LocalCluster {
mut voting_keypair: Option<Arc<Keypair>>,
socket_addr_space: SocketAddrSpace,
) -> Pubkey {
let (rpc, tpu) = self.entry_point_info.client_facing_addr();
let (rpc, tpu) = cluster_tests::get_client_facing_addr(&self.entry_point_info);
let client = ThinClient::new(rpc, tpu, self.connection_cache.clone());
// Must have enough tokens to fund vote account and set delegate
@ -512,7 +512,7 @@ impl LocalCluster {
}
pub fn transfer(&self, source_keypair: &Keypair, dest_pubkey: &Pubkey, lamports: u64) -> u64 {
let (rpc, tpu) = self.entry_point_info.client_facing_addr();
let (rpc, tpu) = cluster_tests::get_client_facing_addr(&self.entry_point_info);
let client = ThinClient::new(rpc, tpu, self.connection_cache.clone());
Self::transfer_with_client(&client, source_keypair, dest_pubkey, lamports)
}
@ -759,7 +759,7 @@ impl Cluster for LocalCluster {
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient> {
self.validators.get(pubkey).map(|f| {
let (rpc, tpu) = f.info.contact_info.client_facing_addr();
let (rpc, tpu) = cluster_tests::get_client_facing_addr(&f.info.contact_info);
ThinClient::new(rpc, tpu, self.connection_cache.clone())
})
}

View File

@ -191,7 +191,7 @@ fn test_local_cluster_signature_subscribe() {
.unwrap();
let non_bootstrap_info = cluster.get_contact_info(&non_bootstrap_id).unwrap();
let (rpc, tpu) = non_bootstrap_info.client_facing_addr();
let (rpc, tpu) = cluster_tests::get_client_facing_addr(non_bootstrap_info);
let tx_client = ThinClient::new(rpc, tpu, cluster.connection_cache.clone());
let (blockhash, _) = tx_client
@ -418,7 +418,7 @@ fn test_mainnet_beta_cluster_type() {
.unwrap();
assert_eq!(cluster_nodes.len(), 1);
let (rpc, tpu) = cluster.entry_point_info.client_facing_addr();
let (rpc, tpu) = cluster_tests::get_client_facing_addr(&cluster.entry_point_info);
let client = ThinClient::new(rpc, tpu, cluster.connection_cache.clone());
// Programs that are available at epoch 0