TpuClient now uses the processed slot to seed its leader schedule cache

This commit is contained in:
Michael Vines
2021-09-08 11:26:44 -05:00
committed by mergify[bot]
parent a0e6a7c73b
commit d7e6ab58c4

View File

@ -5,7 +5,9 @@ use crate::{
}; };
use bincode::serialize; use bincode::serialize;
use log::*; use log::*;
use solana_sdk::{clock::Slot, pubkey::Pubkey, transaction::Transaction}; use solana_sdk::{
clock::Slot, commitment_config::CommitmentConfig, pubkey::Pubkey, transaction::Transaction,
};
use std::{ use std::{
collections::{HashMap, HashSet, VecDeque}, collections::{HashMap, HashSet, VecDeque},
net::{SocketAddr, UdpSocket}, net::{SocketAddr, UdpSocket},
@ -242,7 +244,7 @@ struct LeaderTpuService {
impl LeaderTpuService { impl LeaderTpuService {
fn new(rpc_client: Arc<RpcClient>, websocket_url: &str, exit: Arc<AtomicBool>) -> Result<Self> { fn new(rpc_client: Arc<RpcClient>, websocket_url: &str, exit: Arc<AtomicBool>) -> Result<Self> {
let start_slot = rpc_client.get_max_shred_insert_slot()?; let start_slot = rpc_client.get_slot_with_commitment(CommitmentConfig::processed())?;
let recent_slots = RecentLeaderSlots::new(start_slot); let recent_slots = RecentLeaderSlots::new(start_slot);
let leader_tpu_cache = Arc::new(RwLock::new(LeaderTpuCache::new(&rpc_client, start_slot))); let leader_tpu_cache = Arc::new(RwLock::new(LeaderTpuCache::new(&rpc_client, start_slot)));