Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Use estimated current slot in tpu client (#28997)
Browse files Browse the repository at this point in the history
(cherry picked from commit 07d21d4)
  • Loading branch information
pgarg66 committed Dec 1, 2022
1 parent 1455127 commit bd383d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,15 @@ impl LeaderTpuCache {
// Get the TPU sockets for the current leader and upcoming leaders according to fanout size
pub(crate) fn get_leader_sockets(
&self,
current_slot: Slot,
estimated_current_slot: Slot,
fanout_slots: u64,
) -> Vec<SocketAddr> {
let mut leader_set = HashSet::new();
let mut leader_sockets = Vec::new();
// `first_slot` might have been advanced since caller last read the `estimated_current_slot`
// value. Take the greater of the two values to ensure we are reading from the latest
// leader schedule.
let current_slot = std::cmp::max(estimated_current_slot, self.first_slot);
for leader_slot in current_slot..current_slot + fanout_slots {
if let Some(leader) = self.get_slot_leader(leader_slot) {
if let Some(tpu_socket) = self.leader_tpu_map.get(leader) {
Expand Down

0 comments on commit bd383d9

Please sign in to comment.