Add retry mechanism when downloading genesis and snapshots

This commit is contained in:
Michael Vines
2020-02-25 10:41:13 -07:00
parent 2c63cf3cbd
commit fbf78b83c4
6 changed files with 169 additions and 121 deletions

View File

@ -44,6 +44,7 @@ use solana_sdk::{
timing::timestamp,
};
use std::{
collections::HashSet,
net::{IpAddr, Ipv4Addr, SocketAddr},
path::{Path, PathBuf},
process,
@ -73,6 +74,7 @@ pub struct ValidatorConfig {
pub fixed_leader_schedule: Option<FixedSchedule>,
pub wait_for_supermajority: bool,
pub new_hard_forks: Option<Vec<Slot>>,
pub trusted_validators: Option<HashSet<Pubkey>>, // None = trust all
}
impl Default for ValidatorConfig {
@ -95,6 +97,7 @@ impl Default for ValidatorConfig {
fixed_leader_schedule: None,
wait_for_supermajority: false,
new_hard_forks: None,
trusted_validators: None,
}
}
}
@ -341,9 +344,7 @@ impl Validator {
}
if let Some(snapshot_hash) = snapshot_hash {
if let Some(ref trusted_validators) =
config.snapshot_config.as_ref().unwrap().trusted_validators
{
if let Some(ref trusted_validators) = config.trusted_validators {
let mut trusted = false;
for _ in 0..10 {
trusted = cluster_info