diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 6391c4466..c68d5114f 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -102,8 +102,8 @@ const MAX_SNAPSHOT_SUBPARTS: usize = 256; /// Configuration for the Snapshot service #[derive(Debug, Clone, PartialEq)] pub struct SnapshotConfiguration { - /// If `true`, no periodic snapshots will be created - pub no_periodic: bool, + /// Enable creation of periodic snapshots + pub enable: bool, /// Number of threads for creating snapshots pub processing_threads: usize, } @@ -111,7 +111,7 @@ pub struct SnapshotConfiguration { impl Default for SnapshotConfiguration { fn default() -> Self { SnapshotConfiguration { - no_periodic: false, + enable: false, processing_threads: ::std::cmp::max(1, num_cpus::get_physical() / 2), } } diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index ab80e6d99..6c67b3d6f 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -795,9 +795,9 @@ usage! { "Skip block seal check.", ["Snapshot Options"] - FLAG flag_no_periodic_snapshot: (bool) = false, or |c: &Config| c.snapshots.as_ref()?.disable_periodic.clone(), - "--no-periodic-snapshot", - "Disable automated snapshots which usually occur once every 5000 blocks.", + FLAG flag_enable_snapshotting: (bool) = false, or |c: &Config| c.snapshots.as_ref()?.enable.clone(), + "--enable-snapshotting", + "Enable automated snapshots which usually occur once every 5000 blocks.", ARG arg_snapshot_threads: (Option) = None, or |c: &Config| c.snapshots.as_ref()?.processing_threads, "--snapshot-threads=[NUM]", @@ -1012,7 +1012,7 @@ struct Footprint { #[derive(Default, Debug, PartialEq, Deserialize)] #[serde(deny_unknown_fields)] struct Snapshots { - disable_periodic: Option, + enable: Option, processing_threads: Option, } @@ -1419,7 +1419,7 @@ mod tests { // -- Snapshot Optons arg_export_state_at: "latest".into(), arg_snapshot_at: "latest".into(), - flag_no_periodic_snapshot: false, + flag_enable_snapshotting: false, arg_snapshot_threads: None, // -- Internal Options @@ -1609,7 +1609,7 @@ mod tests { num_verifiers: None, }), snapshots: Some(Snapshots { - disable_periodic: Some(true), + enable: Some(false), processing_threads: None, }), misc: Some(Misc { diff --git a/parity/cli/tests/config.full.toml b/parity/cli/tests/config.full.toml index 87da3c919..061537ade 100644 --- a/parity/cli/tests/config.full.toml +++ b/parity/cli/tests/config.full.toml @@ -118,7 +118,7 @@ scale_verifiers = true num_verifiers = 6 [snapshots] -disable_periodic = false +enable = false [misc] logging = "own_tx=trace" diff --git a/parity/cli/tests/config.toml b/parity/cli/tests/config.toml index 6e499e910..db6e94d11 100644 --- a/parity/cli/tests/config.toml +++ b/parity/cli/tests/config.toml @@ -65,7 +65,7 @@ fat_db = "off" scale_verifiers = false [snapshots] -disable_periodic = true +enable = false [misc] logging = "own_tx=trace" diff --git a/parity/configuration.rs b/parity/configuration.rs index 67854aab4..e346420b7 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -967,7 +967,7 @@ impl Configuration { fn snapshot_config(&self) -> Result { let conf = SnapshotConfiguration { - no_periodic: self.args.flag_no_periodic_snapshot, + enable: self.args.flag_enable_snapshotting, processing_threads: match self.args.arg_snapshot_threads { Some(threads) if threads > 0 => threads, _ => ::std::cmp::max(1, num_cpus::get_physical() / 2), diff --git a/parity/run.rs b/parity/run.rs index 1e36519ec..b6ba302b7 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -556,9 +556,9 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result None, - false => { + let watcher = match cmd.snapshot_conf.enable { + false => None, + true => { let sync = sync_provider.clone(); let client = client.clone(); let watcher = Arc::new(snapshot::Watcher::new(