mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 16:31:07 +00:00
sc-informant: Do not show Block history if doing major sync (#14094)
After warp syncing a node it still downloads the block history. If the node is stopped and then started later while downloading the block history, the node first needs to do a major sync to sync to the tip of the chain. Before informant was showing `Block history` as sync state, while we actually were doing a major sync. This pr is fixing this.
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user