solana_send_transaction_service/
tpu_info.rs

1use {
2    solana_connection_cache::connection_cache::Protocol, solana_sdk::clock::Slot,
3    std::net::SocketAddr,
4};
5
6pub trait TpuInfo {
7    fn refresh_recent_peers(&mut self);
8    fn get_leader_tpus(&self, max_count: u64, protocol: Protocol) -> Vec<&SocketAddr>;
9    /// In addition to the the tpu address, also return the leader slot
10    fn get_leader_tpus_with_slots(
11        &self,
12        max_count: u64,
13        protocol: Protocol,
14    ) -> Vec<(&SocketAddr, Slot)>;
15}
16
17#[derive(Clone)]
18pub struct NullTpuInfo;
19
20impl TpuInfo for NullTpuInfo {
21    fn refresh_recent_peers(&mut self) {}
22    fn get_leader_tpus(&self, _max_count: u64, _protocol: Protocol) -> Vec<&SocketAddr> {
23        vec![]
24    }
25    fn get_leader_tpus_with_slots(
26        &self,
27        _max_count: u64,
28        _protocol: Protocol,
29    ) -> Vec<(&SocketAddr, Slot)> {
30        vec![]
31    }
32}