warp-sync: Return an error when trying to enable it for archive nodes. (#11086)

* warp-sync: Return an error when trying to enable it for archive nodes.

* Fix checks

* Ups

* FMT
This commit is contained in:
Bastian Köcher
2022-03-22 13:25:34 +01:00
committed by GitHub
parent 61f1b2e6ab
commit a1008016b7
2 changed files with 26 additions and 2 deletions
+13 -1
View File
@@ -377,8 +377,8 @@ impl From<multiaddr::Error> for ParseErr {
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
/// Sync operation mode.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum SyncMode {
/// Full block download and verification.
Full,
@@ -393,6 +393,18 @@ pub enum SyncMode {
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