Skip to content

Commit

Permalink
Make wait_for_restart_window() aware of Incremental Snapshots (#19587)
Browse files Browse the repository at this point in the history
When the validator is waiting to restart, the snapshot slot is checked.
With Incremental Snapshots, the full snapshot interval is going to be
_much_ higher, which would make this function wait for a looooong time.

So, if there's an incremental snapshot slot when checking, use that
slot, otherwise fall back to the full snapshot slot.
  • Loading branch information
brooksprumo authored Sep 3, 2021
1 parent 7ab0aec commit fb1b853
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,17 @@ fn wait_for_restart_window(
}
};

let full_snapshot_slot =
snapshot_slot_info.map(|snapshot_slot_info| snapshot_slot_info.full);
let snapshot_slot = snapshot_slot_info.map(|snapshot_slot_info| {
snapshot_slot_info
.incremental
.unwrap_or(snapshot_slot_info.full)
});
match in_leader_schedule_hole {
Ok(_) => {
if restart_snapshot == None {
restart_snapshot = full_snapshot_slot;
restart_snapshot = snapshot_slot;
}
if restart_snapshot == full_snapshot_slot && !monitoring_another_validator {
if restart_snapshot == snapshot_slot && !monitoring_another_validator {
"Waiting for a new snapshot".to_string()
} else if delinquent_stake_percentage >= min_delinquency_percentage {
style("Delinquency too high").red().to_string()
Expand Down Expand Up @@ -316,10 +319,18 @@ fn wait_for_restart_window(
"".to_string()
} else {
format!(
"| Full Snapshot Slot: {}",
"| Full Snapshot Slot: {} | Incremental Snapshot Slot: {}",
snapshot_slot_info
.as_ref()
.map(|snapshot_slot_info| snapshot_slot_info.full.to_string())
.unwrap_or_else(|| '-'.to_string()),
snapshot_slot_info
.as_ref()
.map(|snapshot_slot_info| snapshot_slot_info
.incremental
.map(|incremental| incremental.to_string()))
.flatten()
.unwrap_or_else(|| '-'.to_string()),
)
},
delinquent_stake_percentage * 100.,
Expand Down

0 comments on commit fb1b853

Please sign in to comment.