diff --git a/parity/blockchain.rs b/parity/blockchain.rs index fae9a3bfc..a70272931 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -531,10 +531,12 @@ pub fn kill_db(cmd: KillBlockchain) -> Result<(), String> { let genesis_hash = spec.genesis_header().hash(); let db_dirs = cmd.dirs.database(genesis_hash, None, spec.data_dir); let user_defaults_path = db_dirs.user_defaults_path(); - let user_defaults = UserDefaults::load(&user_defaults_path)?; + let mut user_defaults = UserDefaults::load(&user_defaults_path)?; let algorithm = cmd.pruning.to_algorithm(&user_defaults); let dir = db_dirs.db_path(algorithm); fs::remove_dir_all(&dir).map_err(|e| format!("Error removing database: {:?}", e))?; + user_defaults.is_first_launch = true; + user_defaults.save(&user_defaults_path)?; info!("Database deleted."); Ok(()) } diff --git a/parity/run.rs b/parity/run.rs index 15e09d74a..6f0b444a0 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -754,6 +754,7 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc) -> R service.register_io_handler(informant.clone()).map_err(|_| "Unable to register informant handler".to_owned())?; // save user defaults + user_defaults.is_first_launch = false; user_defaults.pruning = algorithm; user_defaults.tracing = tracing; user_defaults.fat_db = fat_db; diff --git a/parity/user_defaults.rs b/parity/user_defaults.rs index 12bb9937f..703b3bf16 100644 --- a/parity/user_defaults.rs +++ b/parity/user_defaults.rs @@ -41,6 +41,7 @@ impl Serialize for UserDefaults { fn serialize(&self, serializer: S) -> Result where S: Serializer { let mut map: BTreeMap = BTreeMap::new(); + map.insert("is_first_launch".into(), Value::Bool(self.is_first_launch)); map.insert("pruning".into(), Value::String(self.pruning.as_str().into())); map.insert("tracing".into(), Value::Bool(self.tracing)); map.insert("fat_db".into(), Value::Bool(self.fat_db));