Skip to content

Commit

Permalink
Add some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nk4rter committed Feb 11, 2025
1 parent 34e569e commit 6cdb076
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions watchtower/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use {
solana_rpc_client::rpc_client::RpcClient,
solana_rpc_client_api::{client_error, response::RpcVoteAccountStatus},
std::{
collections::{BTreeMap, HashMap},
collections::HashMap,
error,
thread::sleep,
time::{Duration, Instant},
Expand Down Expand Up @@ -403,13 +403,13 @@ fn main() -> Result<(), Box<dyn error::Error>> {

let notifier = Notifier::default();

let mut last_notification_msg = "".to_string();
let mut last_notification_msg = "".into();
let mut num_consecutive_failures = 0;
let mut last_success = Instant::now();
let mut incident = Hash::new_unique();

loop {
let mut failures = BTreeMap::new(); // test_name -> message
let mut failures = HashMap::new(); // test_name -> message

let mut num_healthy = 0;
let mut num_reachable = 0;
Expand All @@ -433,10 +433,10 @@ fn main() -> Result<(), Box<dyn error::Error>> {
}

if num_reachable < min_agreeing_endpoints {
failures.clear(); // Ignoring other failures when watchtower is unrealiable
failures.clear(); // Ignoring other failures when watchtower is unreliable

let watchtower_unreliable_msg = format!(
"Watchtower is unrealiable, {} of {} RPC endpoints are reachable",
"Watchtower is unreliable, {} of {} RPC endpoints are reachable",
num_reachable,
endpoints.len()
);
Expand All @@ -445,10 +445,10 @@ fn main() -> Result<(), Box<dyn error::Error>> {

if num_healthy < min_agreeing_endpoints {
if failures.len() > 1 {
failures.clear(); // Ignoring other failures when watchtower is unrealiable
failures.clear(); // Ignoring other failures when watchtower is unreliable

let watchtower_unreliable_msg =
"Watchtower is unrealiable, RPC endpoints provide inconsistent information"
"Watchtower is unreliable, RPC endpoints provide inconsistent information"
.into();
failures.insert("watchtower-reliability".into(), watchtower_unreliable_msg);
}
Expand Down

0 comments on commit 6cdb076

Please sign in to comment.