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

Commit

Permalink
WarpSync: Show number of required peers in informant (#14190)
Browse files Browse the repository at this point in the history
This makes it for the user more obvious on what we are waiting and not just "waiting for peers".
  • Loading branch information
bkchr authored and Ank4n committed Jul 8, 2023
1 parent 7b47b24 commit 4a2269c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions client/network/common/src/sync/warp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub trait WarpSyncProvider<Block: BlockT>: Send + Sync {
#[derive(Clone, Eq, PartialEq, Debug)]
pub enum WarpSyncPhase<Block: BlockT> {
/// Waiting for peers to connect.
AwaitingPeers,
AwaitingPeers { required_peers: usize },
/// Waiting for target block to be received.
AwaitingTargetBlock,
/// Downloading and verifying grandpa warp proofs.
Expand All @@ -90,7 +90,8 @@ pub enum WarpSyncPhase<Block: BlockT> {
impl<Block: BlockT> fmt::Display for WarpSyncPhase<Block> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::AwaitingPeers => write!(f, "Waiting for peers"),
Self::AwaitingPeers { required_peers } =>
write!(f, "Waiting for {required_peers} peers to be connected"),
Self::AwaitingTargetBlock => write!(f, "Waiting for target block to be received"),
Self::DownloadingWarpProofs => write!(f, "Downloading finality proofs"),
Self::DownloadingTargetBlock => write!(f, "Downloading target block"),
Expand Down
8 changes: 6 additions & 2 deletions client/network/sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,12 @@ where
phase: WarpSyncPhase::DownloadingBlocks(gap_sync.best_queued_number),
total_bytes: 0,
}),
(None, SyncMode::Warp, _) =>
Some(WarpSyncProgress { phase: WarpSyncPhase::AwaitingPeers, total_bytes: 0 }),
(None, SyncMode::Warp, _) => Some(WarpSyncProgress {
phase: WarpSyncPhase::AwaitingPeers {
required_peers: MIN_PEERS_TO_START_WARP_SYNC,
},
total_bytes: 0,
}),
(Some(sync), _, _) => Some(sync.progress()),
_ => None,
};
Expand Down

0 comments on commit 4a2269c

Please sign in to comment.