mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 21:17:56 +00:00
Actually fix major sync detection (#12114)
* Actually fix major sync detection * Introduce `SyncState::Importing` state * Add target to SyncState enum variants and add `is_major_syncing` method on it * Remove unnecessary duplicated `best_seen_block` from `SyncState` struct * Revert "Remove unnecessary duplicated `best_seen_block` from `SyncState` struct" This reverts commit bb8abd458c939881c049f69d59f3acba47c97c5c. * Add missing `websocket` feature to `libp2p` Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -93,42 +93,37 @@ impl<B: BlockT> InformantDisplay<B> {
|
||||
(diff_bytes_inbound, diff_bytes_outbound)
|
||||
};
|
||||
|
||||
let (level, status, target) = match (
|
||||
net_status.sync_state,
|
||||
net_status.best_seen_block,
|
||||
net_status.state_sync,
|
||||
net_status.warp_sync,
|
||||
) {
|
||||
(
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
Some(WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(n), .. }),
|
||||
) => ("⏩", "Block history".into(), format!(", #{}", n)),
|
||||
(_, _, _, Some(warp)) => (
|
||||
"⏩",
|
||||
"Warping".into(),
|
||||
format!(
|
||||
", {}, {:.2} Mib",
|
||||
warp.phase,
|
||||
(warp.total_bytes as f32) / (1024f32 * 1024f32)
|
||||
let (level, status, target) =
|
||||
match (net_status.sync_state, net_status.state_sync, net_status.warp_sync) {
|
||||
(
|
||||
_,
|
||||
_,
|
||||
Some(WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(n), .. }),
|
||||
) => ("⏩", "Block history".into(), format!(", #{}", n)),
|
||||
(_, _, Some(warp)) => (
|
||||
"⏩",
|
||||
"Warping".into(),
|
||||
format!(
|
||||
", {}, {:.2} Mib",
|
||||
warp.phase,
|
||||
(warp.total_bytes as f32) / (1024f32 * 1024f32)
|
||||
),
|
||||
),
|
||||
),
|
||||
(_, _, Some(state), _) => (
|
||||
"⚙️ ",
|
||||
"Downloading state".into(),
|
||||
format!(
|
||||
", {}%, {:.2} Mib",
|
||||
state.percentage,
|
||||
(state.size as f32) / (1024f32 * 1024f32)
|
||||
(_, Some(state), _) => (
|
||||
"⚙️ ",
|
||||
"Downloading state".into(),
|
||||
format!(
|
||||
", {}%, {:.2} Mib",
|
||||
state.percentage,
|
||||
(state.size as f32) / (1024f32 * 1024f32)
|
||||
),
|
||||
),
|
||||
),
|
||||
(SyncState::Idle, _, _, _) => ("💤", "Idle".into(), "".into()),
|
||||
(SyncState::Downloading, None, _, _) =>
|
||||
("⚙️ ", format!("Preparing{}", speed), "".into()),
|
||||
(SyncState::Downloading, Some(n), None, _) =>
|
||||
("⚙️ ", format!("Syncing{}", speed), format!(", target=#{}", n)),
|
||||
};
|
||||
(SyncState::Idle, _, _) => ("💤", "Idle".into(), "".into()),
|
||||
(SyncState::Downloading { target }, _, _) =>
|
||||
("⚙️ ", format!("Syncing{}", speed), format!(", target=#{target}")),
|
||||
(SyncState::Importing { target }, _, _) =>
|
||||
("⚙️ ", format!("Preparing{}", speed), format!(", target=#{target}")),
|
||||
};
|
||||
|
||||
if self.format.enable_color {
|
||||
info!(
|
||||
|
||||
Reference in New Issue
Block a user