removes feature gate code sending votes to tpu-vote-port (#31529)

This commit is contained in:
behzad nouri 2023-05-08 18:12:35 +00:00 committed by GitHub
parent 8d98589c85
commit 8e638b785a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 29 deletions

View File

@ -7,13 +7,6 @@ use {
std::{net::SocketAddr, sync::RwLock}, std::{net::SocketAddr, sync::RwLock},
}; };
pub(crate) fn next_leader_tpu(
cluster_info: &ClusterInfo,
poh_recorder: &RwLock<PohRecorder>,
) -> Option<(Pubkey, SocketAddr)> {
next_leader_x(cluster_info, poh_recorder, ContactInfo::tpu)
}
pub(crate) fn next_leader_tpu_forwards( pub(crate) fn next_leader_tpu_forwards(
cluster_info: &ClusterInfo, cluster_info: &ClusterInfo,
poh_recorder: &RwLock<PohRecorder>, poh_recorder: &RwLock<PohRecorder>,

View File

@ -6684,7 +6684,6 @@ pub(crate) mod tests {
&poh_recorder, &poh_recorder,
&tower_storage, &tower_storage,
vote_info, vote_info,
false,
); );
let mut cursor = Cursor::default(); let mut cursor = Cursor::default();
@ -6749,7 +6748,6 @@ pub(crate) mod tests {
&poh_recorder, &poh_recorder,
&tower_storage, &tower_storage,
vote_info, vote_info,
false,
); );
let votes = cluster_info.get_votes(&mut cursor); let votes = cluster_info.get_votes(&mut cursor);
assert_eq!(votes.len(), 1); assert_eq!(votes.len(), 1);
@ -6825,7 +6823,6 @@ pub(crate) mod tests {
&poh_recorder, &poh_recorder,
&tower_storage, &tower_storage,
vote_info, vote_info,
false,
); );
assert!(last_vote_refresh_time.last_refresh_time > clone_refresh_time); assert!(last_vote_refresh_time.last_refresh_time > clone_refresh_time);

View File

@ -257,7 +257,6 @@ impl Tvu {
cluster_info.clone(), cluster_info.clone(),
poh_recorder.clone(), poh_recorder.clone(),
tower_storage, tower_storage,
bank_forks.clone(),
); );
let warm_quic_cache_service = if connection_cache.use_quic() { let warm_quic_cache_service = if connection_cache.use_quic() {

View File

@ -1,10 +1,12 @@
use { use {
crate::tower_storage::{SavedTowerVersions, TowerStorage}, crate::{
next_leader::next_leader_tpu_vote,
tower_storage::{SavedTowerVersions, TowerStorage},
},
crossbeam_channel::Receiver, crossbeam_channel::Receiver,
solana_gossip::cluster_info::ClusterInfo, solana_gossip::cluster_info::ClusterInfo,
solana_measure::measure::Measure, solana_measure::measure::Measure,
solana_poh::poh_recorder::PohRecorder, solana_poh::poh_recorder::PohRecorder,
solana_runtime::bank_forks::BankForks,
solana_sdk::{clock::Slot, transaction::Transaction}, solana_sdk::{clock::Slot, transaction::Transaction},
std::{ std::{
sync::{Arc, RwLock}, sync::{Arc, RwLock},
@ -43,20 +45,16 @@ impl VotingService {
cluster_info: Arc<ClusterInfo>, cluster_info: Arc<ClusterInfo>,
poh_recorder: Arc<RwLock<PohRecorder>>, poh_recorder: Arc<RwLock<PohRecorder>>,
tower_storage: Arc<dyn TowerStorage>, tower_storage: Arc<dyn TowerStorage>,
bank_forks: Arc<RwLock<BankForks>>,
) -> Self { ) -> Self {
let thread_hdl = Builder::new() let thread_hdl = Builder::new()
.name("solVoteService".to_string()) .name("solVoteService".to_string())
.spawn(move || { .spawn(move || {
for vote_op in vote_receiver.iter() { for vote_op in vote_receiver.iter() {
let rooted_bank = bank_forks.read().unwrap().root_bank().clone();
let send_to_tpu_vote_port = rooted_bank.send_to_tpu_vote_port_enabled();
Self::handle_vote( Self::handle_vote(
&cluster_info, &cluster_info,
&poh_recorder, &poh_recorder,
tower_storage.as_ref(), tower_storage.as_ref(),
vote_op, vote_op,
send_to_tpu_vote_port,
); );
} }
}) })
@ -69,7 +67,6 @@ impl VotingService {
poh_recorder: &RwLock<PohRecorder>, poh_recorder: &RwLock<PohRecorder>,
tower_storage: &dyn TowerStorage, tower_storage: &dyn TowerStorage,
vote_op: VoteOp, vote_op: VoteOp,
send_to_tpu_vote_port: bool,
) { ) {
if let VoteOp::PushVote { saved_tower, .. } = &vote_op { if let VoteOp::PushVote { saved_tower, .. } = &vote_op {
let mut measure = Measure::start("tower_save-ms"); let mut measure = Measure::start("tower_save-ms");
@ -81,14 +78,10 @@ impl VotingService {
inc_new_counter_info!("tower_save-ms", measure.as_ms() as usize); inc_new_counter_info!("tower_save-ms", measure.as_ms() as usize);
} }
let pubkey_and_target_address = if send_to_tpu_vote_port {
crate::next_leader::next_leader_tpu_vote(cluster_info, poh_recorder)
} else {
crate::next_leader::next_leader_tpu(cluster_info, poh_recorder)
};
let _ = cluster_info.send_transaction( let _ = cluster_info.send_transaction(
vote_op.tx(), vote_op.tx(),
pubkey_and_target_address.map(|(_pubkey, target_addr)| target_addr), next_leader_tpu_vote(cluster_info, poh_recorder)
.map(|(_pubkey, target_addr)| target_addr),
); );
match vote_op { match vote_op {

View File

@ -7471,11 +7471,6 @@ impl Bank {
.is_active(&feature_set::credits_auto_rewind::id()) .is_active(&feature_set::credits_auto_rewind::id())
} }
pub fn send_to_tpu_vote_port_enabled(&self) -> bool {
self.feature_set
.is_active(&feature_set::send_to_tpu_vote_port::id())
}
pub fn read_cost_tracker(&self) -> LockResult<RwLockReadGuard<CostTracker>> { pub fn read_cost_tracker(&self) -> LockResult<RwLockReadGuard<CostTracker>> {
self.cost_tracker.read() self.cost_tracker.read()
} }