Unify SyncMode data structures under one (#14465)

This commit is contained in:
Nazar Mokrynskyi
2023-06-29 18:25:41 +03:00
committed by GitHub
parent f1c16d05e7
commit ff7e8b6b17
10 changed files with 50 additions and 152 deletions
+1 -35
View File
@@ -38,7 +38,7 @@ use zeroize::Zeroize;
pub use sc_network_common::{
role::{Role, Roles},
sync::warp::WarpSyncProvider,
sync::{warp::WarpSyncProvider, SyncMode},
ExHashT,
};
use sc_utils::mpsc::TracingUnboundedSender;
@@ -277,40 +277,6 @@ impl NonReservedPeerMode {
}
}
/// Sync operation mode.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum SyncMode {
/// Full block download and verification.
Full,
/// Download blocks and the latest state.
Fast {
/// Skip state proof download and verification.
skip_proofs: bool,
/// Download indexed transactions for recent blocks.
storage_chain_mode: bool,
},
/// Warp sync - verify authority set transitions and the latest state.
Warp,
}
impl SyncMode {
/// Returns if `self` is [`Self::Warp`].
pub fn is_warp(&self) -> bool {
matches!(self, Self::Warp)
}
/// Returns if `self` is [`Self::Fast`].
pub fn is_fast(&self) -> bool {
matches!(self, Self::Fast { .. })
}
}
impl Default for SyncMode {
fn default() -> Self {
Self::Full
}
}
/// The configuration of a node's secret key, describing the type of key
/// and how it is obtained. A node's identity keypair is the result of
/// the evaluation of the node key configuration.