Skip to content

Commit

Permalink
Change LeaderUpdater trait to accept mut self
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillLykov committed Nov 5, 2024
1 parent 643311f commit 6842b79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tpu-client-next/src/leader_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub trait LeaderUpdater: Send {
/// If the current leader estimation is incorrect and transactions are sent to
/// only one estimated leader, there is a risk of losing all the transactions,
/// depending on the forwarding policy.
fn next_leaders(&self, lookahead_slots: u64) -> Vec<SocketAddr>;
fn next_leaders(&mut self, lookahead_slots: u64) -> Vec<SocketAddr>;

/// Stop [`LeaderUpdater`] and releases all associated resources.
async fn stop(&mut self);
Expand Down Expand Up @@ -98,7 +98,7 @@ struct LeaderUpdaterService {

#[async_trait]
impl LeaderUpdater for LeaderUpdaterService {
fn next_leaders(&self, lookahead_slots: u64) -> Vec<SocketAddr> {
fn next_leaders(&mut self, lookahead_slots: u64) -> Vec<SocketAddr> {
self.leader_tpu_service.leader_tpu_sockets(lookahead_slots)
}

Expand All @@ -116,7 +116,7 @@ struct PinnedLeaderUpdater {

#[async_trait]
impl LeaderUpdater for PinnedLeaderUpdater {
fn next_leaders(&self, _lookahead_slots: u64) -> Vec<SocketAddr> {
fn next_leaders(&mut self, _lookahead_slots: u64) -> Vec<SocketAddr> {
self.address.clone()
}

Expand Down

0 comments on commit 6842b79

Please sign in to comment.