Add "removedb" command to Geth

Removes the state and blockchain databases
This commit is contained in:
Taylor Gerring 2015-05-18 10:54:15 -05:00
parent 677796b351
commit fe41bd6fe8

View File

@ -230,6 +230,11 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
Name: "upgradedb", Name: "upgradedb",
Usage: "upgrade chainblock database", Usage: "upgrade chainblock database",
}, },
{
Action: removeDb,
Name: "removedb",
Usage: "Remove blockchain and state databases",
},
} }
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
utils.IdentityFlag, utils.IdentityFlag,
@ -543,6 +548,16 @@ func exportchain(ctx *cli.Context) {
return 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) { func upgradeDb(ctx *cli.Context) {
fmt.Println("Upgrade blockchain DB") fmt.Println("Upgrade blockchain DB")