diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-05-18 23:54:15 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-05-18 23:54:15 +0800 |
commit | fe41bd6fe854248d9937ba24e58baeaf672cf94e (patch) | |
tree | b74a26a70230215430b214c7e01adc52e12390d4 | |
parent | 677796b3517782dd530b7a1a7d9dfd16b643404c (diff) | |
download | go-tangerine-fe41bd6fe854248d9937ba24e58baeaf672cf94e.tar.gz go-tangerine-fe41bd6fe854248d9937ba24e58baeaf672cf94e.tar.zst go-tangerine-fe41bd6fe854248d9937ba24e58baeaf672cf94e.zip |
Add "removedb" command to Geth
Removes the state and blockchain databases
-rw-r--r-- | cmd/geth/main.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index b0970212e..b10347781 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -230,6 +230,11 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso Name: "upgradedb", Usage: "upgrade chainblock database", }, + { + Action: removeDb, + Name: "removedb", + Usage: "Remove blockchain and state databases", + }, } app.Flags = []cli.Flag{ utils.IdentityFlag, @@ -543,6 +548,16 @@ func exportchain(ctx *cli.Context) { return } +func removeDb(ctx *cli.Context) { + fmt.Println("Removing chain and state databases...") + start := time.Now() + + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "state")) + + fmt.Printf("Removed in %v\n", time.Since(start)) +} + func upgradeDb(ctx *cli.Context) { fmt.Println("Upgrade blockchain DB") |