From fb1b853b14f230a1ff3517cdb3519b93e70f4d26 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Fri, 3 Sep 2021 11:42:22 -0500 Subject: [PATCH] Make wait_for_restart_window() aware of Incremental Snapshots (#19587) 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. --- validator/src/main.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index d0bfcbc877710c..498413ef60b187 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -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() @@ -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.,