Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

sc-informant: Do not show Block history if doing major sync #14094

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions client/informant/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,36 @@ impl<B: BlockT> InformantDisplay<B> {

let (level, status, target) =
match (sync_status.state, sync_status.state_sync, sync_status.warp_sync) {
// Do not set status to "Block history" when we are doing a major sync.
//
// A node could for example have been warp synced to the tip of the chain and
// shutdown. At the next start we still need to download the block history, but
// first will sync to the tip of the chain.
(
_,
sync_status,
_,
Some(WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(n), .. }),
) => ("⏩", "Block history".into(), format!(", #{}", n)),
) if !sync_status.is_major_syncing() => ("⏩", "Block history".into(), format!(", #{}", n)),
(
_,
_,
Some(WarpSyncProgress { phase: WarpSyncPhase::AwaitingTargetBlock, .. }),
) => ("⏩", "Waiting for pending target block".into(), "".into()),
(_, _, Some(warp)) => (
"⏩",
"Warping".into(),
format!(
", {}, {:.2} Mib",
// Handle all phases besides the two phases we already handle above.
(_, _, Some(warp))
if !matches!(
warp.phase,
(warp.total_bytes as f32) / (1024f32 * 1024f32)
WarpSyncPhase::AwaitingTargetBlock | WarpSyncPhase::DownloadingBlocks(_)
) =>
(
"⏩",
"Warping".into(),
format!(
", {}, {:.2} Mib",
warp.phase,
(warp.total_bytes as f32) / (1024f32 * 1024f32)
),
),
),
(_, Some(state), _) => (
"⚙️ ",
"Downloading state".into(),
Expand Down