From 45cf1d96dffab4372f04a6e4f01a28a9585b711f Mon Sep 17 00:00:00 2001 From: pharazen <47529496+pharazen@users.noreply.github.com> Date: Thu, 25 Jul 2019 04:13:56 -0500 Subject: [PATCH] Adds command to remove chain_data (#2954) --- src/bin/grin.rs | 10 ++++++++++ src/bin/grin.yml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/bin/grin.rs b/src/bin/grin.rs index 181c35da8..4b15f9ea5 100644 --- a/src/bin/grin.rs +++ b/src/bin/grin.rs @@ -169,6 +169,16 @@ fn real_main() -> i32 { // client commands and options ("client", Some(client_args)) => cmd::client_command(client_args, node_config.unwrap()), + // clean command + ("clean", _) => { + let db_root_path = node_config.unwrap().members.unwrap().server.db_root; + println!("Cleaning chain data directory: {}", db_root_path); + match std::fs::remove_dir_all(db_root_path) { + Ok(_) => 0, + Err(_) => 1, + } + }, + // If nothing is specified, try to just use the config file instead // this could possibly become the way to configure most things // with most command line options being phased out diff --git a/src/bin/grin.yml b/src/bin/grin.yml index e286e475e..bf953cd3c 100644 --- a/src/bin/grin.yml +++ b/src/bin/grin.yml @@ -12,6 +12,8 @@ args: long: usernet takes_value: false subcommands: + - clean: + about: Clean Grin chain data - wallet: about: As of v1.1.0, the wallet has been split into a separate executable. See https://github.com/mimblewimble/grin-wallet/releases usage: As of v1.1.0, the wallet has been split into a separate executable. See https://github.com/mimblewimble/grin-wallet/releases to download