Add grandpa telemetry (+ other minor improvements) (#1997)

* Support skipping the interactive purge prompt

Skip it via `cargo run -- purge-chain -y`.

* Fix typos

* Add Grandpa telemetry

* Address comments

* Revert unnecessary version bump

* Version bump to make CI run

* Remove unnecessary cast

* Do not bump version
This commit is contained in:
Michael Müller
2019-03-15 15:04:01 +01:00
committed by Bastian Köcher
parent 35a67b31e5
commit c52c528ee8
31 changed files with 139 additions and 45 deletions
+17 -12
View File
@@ -574,23 +574,28 @@ where
S: FnOnce(&str) -> Result<Option<ChainSpec<FactoryGenesis<F>>>, String>,
{
let config = create_config_with_db_path::<F, _>(spec_factory, &cli.shared_params, version)?;
let db_path = config.database_path;
print!("Are you sure to remove {:?}? (y/n)", &db_path);
stdout().flush().expect("failed to flush stdout");
let mut input = String::new();
stdin().read_line(&mut input)?;
let input = input.trim();
if cli.yes == false {
print!("Are you sure to remove {:?}? (y/n)", &db_path);
stdout().flush().expect("failed to flush stdout");
match input.chars().nth(0) {
Some('y') | Some('Y') => {
fs::remove_dir_all(&db_path)?;
println!("{:?} removed.", &db_path);
},
_ => println!("Aborted"),
let mut input = String::new();
stdin().read_line(&mut input)?;
let input = input.trim();
match input.chars().nth(0) {
Some('y') | Some('Y') => {},
_ => {
println!("Aborted");
return Ok(());
},
}
}
fs::remove_dir_all(&db_path)?;
println!("{:?} removed.", &db_path);
Ok(())
}