|
@ -17,7 +17,7 @@ var ResetAllCmd = &cobra.Command{ |
|
|
Use: "unsafe-reset-all", |
|
|
Use: "unsafe-reset-all", |
|
|
Aliases: []string{"unsafe_reset_all"}, |
|
|
Aliases: []string{"unsafe_reset_all"}, |
|
|
Short: "(unsafe) Remove all the data and WAL, reset this node's validator to genesis state", |
|
|
Short: "(unsafe) Remove all the data and WAL, reset this node's validator to genesis state", |
|
|
Run: resetAllCmd, |
|
|
|
|
|
|
|
|
RunE: resetAllCmd, |
|
|
PreRun: deprecateSnakeCase, |
|
|
PreRun: deprecateSnakeCase, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -28,7 +28,7 @@ var ResetStateCmd = &cobra.Command{ |
|
|
Use: "reset-state", |
|
|
Use: "reset-state", |
|
|
Short: "Remove all the data and WAL", |
|
|
Short: "Remove all the data and WAL", |
|
|
RunE: func(cmd *cobra.Command, args []string) error { |
|
|
RunE: func(cmd *cobra.Command, args []string) error { |
|
|
return resetState(conf.DBDir(), logger) |
|
|
|
|
|
|
|
|
return resetState(config.DBDir(), logger) |
|
|
}, |
|
|
}, |
|
|
PreRun: deprecateSnakeCase, |
|
|
PreRun: deprecateSnakeCase, |
|
|
} |
|
|
} |
|
@ -48,8 +48,8 @@ var ResetPrivValidatorCmd = &cobra.Command{ |
|
|
|
|
|
|
|
|
// XXX: this is totally unsafe.
|
|
|
// XXX: this is totally unsafe.
|
|
|
// it's only suitable for testnets.
|
|
|
// it's only suitable for testnets.
|
|
|
func resetAllCmd(cmd *cobra.Command, args []string) { |
|
|
|
|
|
ResetAll(config.DBDir(), config.P2P.AddrBookFile(), config.PrivValidatorKeyFile(), |
|
|
|
|
|
|
|
|
func resetAllCmd(cmd *cobra.Command, args []string) error { |
|
|
|
|
|
return resetAll(config.DBDir(), config.P2P.AddrBookFile(), config.PrivValidatorKeyFile(), |
|
|
config.PrivValidatorStateFile(), logger) |
|
|
config.PrivValidatorStateFile(), logger) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -60,7 +60,7 @@ func resetPrivValidator(cmd *cobra.Command, args []string) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// resetAll removes address book files plus all data, and resets the privValdiator data.
|
|
|
// resetAll removes address book files plus all data, and resets the privValdiator data.
|
|
|
func resetAll(dbDir, privValKeyFile, privValStateFile string, logger log.Logger) error { |
|
|
|
|
|
|
|
|
func resetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logger log.Logger) error { |
|
|
if keepAddrBook { |
|
|
if keepAddrBook { |
|
|
logger.Info("The address book remains intact") |
|
|
logger.Info("The address book remains intact") |
|
|
} else { |
|
|
} else { |
|
@ -72,7 +72,8 @@ func resetAll(dbDir, privValKeyFile, privValStateFile string, logger log.Logger) |
|
|
logger.Error("Error removing all blockchain history", "dir", dbDir, "err", err) |
|
|
logger.Error("Error removing all blockchain history", "dir", dbDir, "err", err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return resetFilePV(privValKeyFile, privValStateFile, logger) |
|
|
|
|
|
|
|
|
resetFilePV(privValKeyFile, privValStateFile, logger) |
|
|
|
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// resetState removes address book files plus all databases.
|
|
|
// resetState removes address book files plus all databases.
|
|
|