Add quic-client module (#23166)

* Add quic-client module to send transactions via quic, abstracted behind the TpuConnection trait (along with a legacy UDP implementation of TpuConnection) and change thin-client to use TpuConnection
This commit is contained in:
ryleung-solana
2022-03-09 21:33:05 -05:00
committed by GitHub
parent 1fe0d6eeeb
commit 17b00ad3a4
18 changed files with 568 additions and 65 deletions

View File

@ -1,5 +1,5 @@
use {
solana_client::thin_client::ThinClient,
solana_client::{thin_client::ThinClient, udp_client::UdpTpuConnection},
solana_core::validator::{Validator, ValidatorConfig},
solana_gossip::{cluster_info::Node, contact_info::ContactInfo},
solana_sdk::{pubkey::Pubkey, signature::Keypair},
@ -36,7 +36,7 @@ impl ClusterValidatorInfo {
pub trait Cluster {
fn get_node_pubkeys(&self) -> Vec<Pubkey>;
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient>;
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient<UdpTpuConnection>>;
fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo>;
fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo;
fn restart_node(

View File

@ -6,7 +6,10 @@ use {
},
itertools::izip,
log::*,
solana_client::thin_client::{create_client, ThinClient},
solana_client::{
thin_client::{create_client, ThinClient},
udp_client::UdpTpuConnection,
},
solana_core::{
tower_storage::FileTowerStorage,
validator::{Validator, ValidatorConfig, ValidatorStartProgress},
@ -535,7 +538,7 @@ impl LocalCluster {
}
fn transfer_with_client(
client: &ThinClient,
client: &ThinClient<UdpTpuConnection>,
source_keypair: &Keypair,
dest_pubkey: &Pubkey,
lamports: u64,
@ -564,7 +567,7 @@ impl LocalCluster {
}
fn setup_vote_and_stake_accounts(
client: &ThinClient,
client: &ThinClient<UdpTpuConnection>,
vote_account: &Keypair,
from_account: &Arc<Keypair>,
amount: u64,
@ -701,7 +704,7 @@ impl Cluster for LocalCluster {
self.validators.keys().cloned().collect()
}
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient> {
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient<UdpTpuConnection>> {
self.validators.get(pubkey).map(|f| {
create_client(
f.info.contact_info.client_facing_addr(),