From 0f8ff07b510b588e2ff342f94fd1877d8663c2d0 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 13 Feb 2019 15:45:49 -0800 Subject: [PATCH] tpu now hangs on to its cluster_info --- src/fullnode.rs | 4 +--- src/tpu.rs | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/fullnode.rs b/src/fullnode.rs index b729ccb050..ec3a306095 100644 --- a/src/fullnode.rs +++ b/src/fullnode.rs @@ -286,7 +286,7 @@ impl Fullnode { .broadcast .try_clone() .expect("Failed to clone broadcast socket"), - cluster_info.clone(), + &cluster_info, config.sigverify_disabled, max_tick_height, blob_index, @@ -389,7 +389,6 @@ impl Fullnode { self.broadcast_socket .try_clone() .expect("Failed to clone broadcast socket"), - self.cluster_info.clone(), self.sigverify_disabled, max_tick_height, 0, @@ -407,7 +406,6 @@ impl Fullnode { .iter() .map(|s| s.try_clone().expect("Failed to clone TPU sockets")) .collect(), - self.cluster_info.clone(), ); FullnodeReturnType::LeaderToValidatorRotation } diff --git a/src/tpu.rs b/src/tpu.rs index b98b428859..a66ee13628 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -68,6 +68,7 @@ impl ForwarderServices { pub struct Tpu { tpu_mode: Option, exit: Arc, + cluster_info: Arc>, } impl Tpu { @@ -77,7 +78,7 @@ impl Tpu { tick_duration: PohServiceConfig, transactions_sockets: Vec, broadcast_socket: UdpSocket, - cluster_info: Arc>, + cluster_info: &Arc>, sigverify_disabled: bool, max_tick_height: u64, blob_index: u64, @@ -90,6 +91,7 @@ impl Tpu { let mut tpu = Self { tpu_mode: None, exit: Arc::new(AtomicBool::new(false)), + cluster_info: cluster_info.clone(), }; if is_leader { @@ -98,7 +100,6 @@ impl Tpu { tick_duration, transactions_sockets, broadcast_socket, - cluster_info, sigverify_disabled, max_tick_height, blob_index, @@ -108,7 +109,7 @@ impl Tpu { blocktree, ); } else { - tpu.switch_to_forwarder(transactions_sockets, cluster_info); + tpu.switch_to_forwarder(transactions_sockets); } tpu @@ -126,13 +127,9 @@ impl Tpu { } } - pub fn switch_to_forwarder( - &mut self, - transactions_sockets: Vec, - cluster_info: Arc>, - ) { + pub fn switch_to_forwarder(&mut self, transactions_sockets: Vec) { self.tpu_mode_close(); - let tpu_forwarder = TpuForwarder::new(transactions_sockets, cluster_info); + let tpu_forwarder = TpuForwarder::new(transactions_sockets, self.cluster_info.clone()); self.tpu_mode = Some(TpuMode::Forwarder(ForwarderServices::new(tpu_forwarder))); } @@ -143,7 +140,6 @@ impl Tpu { tick_duration: PohServiceConfig, transactions_sockets: Vec, broadcast_socket: UdpSocket, - cluster_info: Arc>, sigverify_disabled: bool, max_tick_height: u64, blob_index: u64, @@ -161,8 +157,11 @@ impl Tpu { self.exit.clone(), &packet_sender.clone(), ); - let cluster_info_vote_listener = - ClusterInfoVoteListener::new(self.exit.clone(), cluster_info.clone(), packet_sender); + let cluster_info_vote_listener = ClusterInfoVoteListener::new( + self.exit.clone(), + self.cluster_info.clone(), + packet_sender, + ); let (sigverify_stage, verified_receiver) = SigVerifyStage::new(packet_receiver, sigverify_disabled); @@ -180,7 +179,7 @@ impl Tpu { let broadcast_service = BroadcastService::new( bank.clone(), broadcast_socket, - cluster_info, + self.cluster_info.clone(), blob_index, bank.leader_scheduler.clone(), entry_receiver,