Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions votor/src/consensus_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
atomic::{AtomicBool, Ordering},
Arc,
},
thread::Builder,
thread::{Builder, JoinHandle},
time::{Duration, Instant},
},
};
Expand Down Expand Up @@ -149,14 +149,14 @@ impl ConsensusMetrics {
epoch: Epoch,
receiver: ConsensusMetricsEventReceiver,
exit: Arc<AtomicBool>,
) {
) -> JoinHandle<()> {
Builder::new()
.name("consensus-metrics".into())
.name("solConsMetrics".into())
.spawn(move || {
let mut metrics = Self::new(epoch, receiver);
metrics.run(exit);
})
.expect("Failed to start consensus metrics thread");
.expect("Failed to start consensus metrics thread")
}

fn run(&mut self, exit: Arc<AtomicBool>) {
Expand Down
2 changes: 1 addition & 1 deletion votor/src/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl EventHandler {
pub(crate) fn new(ctx: EventHandlerContext) -> Self {
let exit = ctx.exit.clone();
let t_event_handler = Builder::new()
.name("solVotorEventLoop".to_string())
.name("solVotorEvLoop".to_string())
.spawn(move || {
if let Err(e) = Self::event_loop(ctx) {
info!("Event loop exited: {e:?}. Shutting down");
Expand Down
2 changes: 1 addition & 1 deletion votor/src/staked_validators_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl StakedValidatorsCache {
nodes.dedup_by_key(|node| node.alpenglow_socket);
nodes.sort_unstable_by(|a, b| a.stake.cmp(&b.stake));

let mut alpenglow_sockets = Vec::new();
let mut alpenglow_sockets = Vec::with_capacity(nodes.len());
let override_map = self
.alpenglow_port_override
.as_ref()
Expand Down
4 changes: 2 additions & 2 deletions votor/src/voting_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub struct VotingContext {
pub consensus_metrics_sender: ConsensusMetricsEventSender,
}

fn get_bls_keypair(
fn get_or_insert_bls_keypair(
derived_bls_keypairs: &mut HashMap<Pubkey, Arc<BLSKeypair>>,
authorized_voter_keypair: &Arc<Keypair>,
) -> Result<Arc<BLSKeypair>, BlsError> {
Expand Down Expand Up @@ -215,7 +215,7 @@ pub fn generate_vote_tx(
authorized_voter_keypair = keypair.clone();
}

let bls_keypair = get_bls_keypair(derived_bls_keypairs, &authorized_voter_keypair)
let bls_keypair = get_or_insert_bls_keypair(derived_bls_keypairs, &authorized_voter_keypair)
.unwrap_or_else(|e| panic!("Failed to derive my own BLS keypair: {e:?}"));
let my_bls_pubkey: BLSPubkey = bls_keypair.public;
if my_bls_pubkey != bls_pubkey_in_vote_account {
Expand Down
11 changes: 9 additions & 2 deletions votor/src/votor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ use {
std::{
collections::HashMap,
sync::{atomic::AtomicBool, Arc, RwLock},
thread,
thread::{self, JoinHandle},
time::Duration,
},
};
Expand Down Expand Up @@ -141,6 +141,7 @@ pub struct Votor {
consensus_pool_service: ConsensusPoolService,
timer_manager: Arc<PlRwLock<TimerManager>>,
consensus_rewards_service: ConsensusRewardsService,
metrics: JoinHandle<()>,
}

impl Votor {
Expand Down Expand Up @@ -247,7 +248,11 @@ impl Votor {
commitment_sender,
};

ConsensusMetrics::start_metrics_loop(root_epoch, consensus_metrics_receiver, exit.clone());
let metrics = ConsensusMetrics::start_metrics_loop(
root_epoch,
consensus_metrics_receiver,
exit.clone(),
);
let event_handler = EventHandler::new(event_handler_context);
let consensus_pool_service = ConsensusPoolService::new(consensus_pool_context);

Expand All @@ -266,6 +271,7 @@ impl Votor {
consensus_pool_service,
timer_manager,
consensus_rewards_service,
metrics,
}
}

Expand All @@ -287,6 +293,7 @@ impl Votor {
}
}
}
self.metrics.join()?;
self.event_handler.join()
}
}