From 92517913b239a6e20f8b26bad9ce2238e9b978e8 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Sat, 28 May 2022 11:55:51 +0200 Subject: [PATCH] Fixed pruning docs (#11519) --- client/cli/src/params/pruning_params.rs | 6 +++--- client/state-db/src/lib.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/cli/src/params/pruning_params.rs b/client/cli/src/params/pruning_params.rs index 0f3d1013381e6..fa30aa53b8a04 100644 --- a/client/cli/src/params/pruning_params.rs +++ b/client/cli/src/params/pruning_params.rs @@ -25,9 +25,9 @@ use sc_service::{KeepBlocks, PruningMode}; pub struct PruningParams { /// Specify the state pruning mode, a number of blocks to keep or 'archive'. /// - /// Default is to keep all block states if the node is running as a - /// validator (i.e. 'archive'), otherwise state is only kept for the last - /// 256 blocks. + /// Default is to keep only the last 256 blocks, + /// otherwise, the state can be kept for all of the blocks (i.e 'archive'), + /// or for all of the canonical blocks (i.e 'archive-canonical'). #[clap(long, value_name = "PRUNING_MODE")] pub pruning: Option, /// Specify the number of finalized blocks to keep in the database. diff --git a/client/state-db/src/lib.rs b/client/state-db/src/lib.rs index 794dec3b954b7..d5cca9a342187 100644 --- a/client/state-db/src/lib.rs +++ b/client/state-db/src/lib.rs @@ -239,7 +239,7 @@ impl PruningMode { } } - /// Is this an archive (either ArchiveAll or ArchiveCanonical) pruning mode? + /// Returns the pruning mode pub fn id(&self) -> &[u8] { match self { PruningMode::ArchiveAll => PRUNING_MODE_ARCHIVE, @@ -247,6 +247,7 @@ impl PruningMode { PruningMode::Constrained(_) => PRUNING_MODE_CONSTRAINED, } } + pub fn from_id(id: &[u8]) -> Option { match id { PRUNING_MODE_ARCHIVE => Some(Self::ArchiveAll),