Add Incremental Snapshot support to RPC (#19559)
#### Problem There's no way to get incremental snapshot information from RPC. #### Summary of Changes - Add new RPC method, `getHighestSnapshotSlot` that returns a `SnapshotSlotInfo`, which contains both the highest full snapshot slot, and the highest incremental snapshot slot _based on_ the full snapshot. - Deprecate old RPC method, `getSnapshotSlot` - Update API docs Fixes #19579
This commit is contained in:
@ -113,13 +113,13 @@ impl Dashboard {
|
||||
}
|
||||
|
||||
let progress_bar = new_spinner_progress_bar();
|
||||
let mut snapshot_slot = None;
|
||||
let mut snapshot_slot_info = None;
|
||||
for i in 0.. {
|
||||
if exit.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
if i % 10 == 0 {
|
||||
snapshot_slot = rpc_client.get_snapshot_slot().ok();
|
||||
snapshot_slot_info = rpc_client.get_highest_snapshot_slot().ok();
|
||||
}
|
||||
|
||||
match get_validator_stats(&rpc_client, &identity) {
|
||||
@ -147,7 +147,7 @@ impl Dashboard {
|
||||
progress_bar.set_message(format!(
|
||||
"{}{}{}| \
|
||||
Processed Slot: {} | Confirmed Slot: {} | Finalized Slot: {} | \
|
||||
Snapshot Slot: {} | \
|
||||
Full Snapshot Slot: {} | Incremental Snapshot Slot: {} \
|
||||
Transactions: {} | {}",
|
||||
uptime,
|
||||
if health == "ok" {
|
||||
@ -163,9 +163,17 @@ impl Dashboard {
|
||||
processed_slot,
|
||||
confirmed_slot,
|
||||
finalized_slot,
|
||||
snapshot_slot
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| "-".to_string()),
|
||||
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()),
|
||||
transaction_count,
|
||||
identity_balance
|
||||
));
|
||||
|
@ -149,7 +149,7 @@ fn wait_for_restart_window(
|
||||
let progress_bar = new_spinner_progress_bar();
|
||||
let monitor_start_time = SystemTime::now();
|
||||
loop {
|
||||
let snapshot_slot = rpc_client.get_snapshot_slot().ok();
|
||||
let snapshot_slot_info = rpc_client.get_highest_snapshot_slot().ok();
|
||||
let epoch_info = rpc_client.get_epoch_info_with_commitment(CommitmentConfig::processed())?;
|
||||
let healthy = rpc_client.get_health().ok().is_some();
|
||||
let delinquent_stake_percentage = {
|
||||
@ -278,13 +278,14 @@ fn wait_for_restart_window(
|
||||
}
|
||||
};
|
||||
|
||||
let full_snapshot_slot =
|
||||
snapshot_slot_info.map(|snapshot_slot_info| snapshot_slot_info.full);
|
||||
match in_leader_schedule_hole {
|
||||
Ok(_) => {
|
||||
if restart_snapshot == None {
|
||||
restart_snapshot = snapshot_slot;
|
||||
restart_snapshot = full_snapshot_slot;
|
||||
}
|
||||
|
||||
if restart_snapshot == snapshot_slot && !monitoring_another_validator {
|
||||
if restart_snapshot == full_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()
|
||||
@ -315,10 +316,10 @@ fn wait_for_restart_window(
|
||||
"".to_string()
|
||||
} else {
|
||||
format!(
|
||||
"| Snapshot Slot: {}",
|
||||
snapshot_slot
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| "-".to_string())
|
||||
"| Full Snapshot Slot: {}",
|
||||
snapshot_slot_info
|
||||
.map(|snapshot_slot_info| snapshot_slot_info.full.to_string())
|
||||
.unwrap_or_else(|| '-'.to_string()),
|
||||
)
|
||||
},
|
||||
delinquent_stake_percentage * 100.,
|
||||
|
Reference in New Issue
Block a user