Browse Source

cli: ResetAll doesnt depend on cobra

pull/451/head
Ethan Buchman 8 years ago
parent
commit
e8cad948e3
1 changed files with 15 additions and 5 deletions
  1. +15
    -5
      cmd/tendermint/commands/reset_priv_validator.go

+ 15
- 5
cmd/tendermint/commands/reset_priv_validator.go View File

@ -5,13 +5,15 @@ import (
"github.com/spf13/cobra"
cfg "github.com/tendermint/go-config"
"github.com/tendermint/log15"
"github.com/tendermint/tendermint/types"
)
var resetAllCmd = &cobra.Command{
Use: "unsafe_reset_all",
Short: "(unsafe) Remove all the data and WAL, reset this node's validator",
Run: ResetAll,
Run: resetAll,
}
var resetPrivValidatorCmd = &cobra.Command{
@ -27,15 +29,23 @@ func init() {
// XXX: this is totally unsafe.
// it's only suitable for testnets.
func ResetAll(cmd *cobra.Command, args []string) {
resetPrivValidator(cmd, args)
os.RemoveAll(config.GetString("db_dir"))
os.Remove(config.GetString("cs_wal_file"))
func resetAll(cmd *cobra.Command, args []string) {
ResetAll(config, log)
}
// XXX: this is totally unsafe.
// it's only suitable for testnets.
func resetPrivValidator(cmd *cobra.Command, args []string) {
ResetPrivValidator(config, log)
}
// Exported so other CLI tools can use it
func ResetAll(c cfg.Config, l log15.Logger) {
ResetPrivValidator(c, l)
os.RemoveAll(c.GetString("db_dir"))
}
func ResetPrivValidator(c cfg.Config, l log15.Logger) {
// Get PrivValidator
var privValidator *types.PrivValidator
privValidatorFile := config.GetString("priv_validator_file")


Loading…
Cancel
Save