changed reset commands
This commit is contained in:
parent
00055fa2e8
commit
47852122d0
|
@ -43,20 +43,21 @@ func resetPrivValidator(cmd *cobra.Command, args []string) {
|
||||||
func ResetAll(c cfg.Config, l log15.Logger) {
|
func ResetAll(c cfg.Config, l log15.Logger) {
|
||||||
ResetPrivValidator(c, l)
|
ResetPrivValidator(c, l)
|
||||||
os.RemoveAll(c.GetString("db_dir"))
|
os.RemoveAll(c.GetString("db_dir"))
|
||||||
|
l.Notice("Removed all data", "dir", dataDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResetPrivValidator(c cfg.Config, l log15.Logger) {
|
func ResetPrivValidator(c cfg.Config, l log15.Logger) {
|
||||||
// Get PrivValidator
|
// Get PrivValidator
|
||||||
var privValidator *types.PrivValidator
|
var privValidator *types.PrivValidator
|
||||||
privValidatorFile := config.GetString("priv_validator_file")
|
privValidatorFile := c.GetString("priv_validator_file")
|
||||||
if _, err := os.Stat(privValidatorFile); err == nil {
|
if _, err := os.Stat(privValidatorFile); err == nil {
|
||||||
privValidator = types.LoadPrivValidator(privValidatorFile)
|
privValidator = types.LoadPrivValidator(privValidatorFile)
|
||||||
privValidator.Reset()
|
privValidator.Reset()
|
||||||
log.Notice("Reset PrivValidator", "file", privValidatorFile)
|
l.Notice("Reset PrivValidator", "file", privValidatorFile)
|
||||||
} else {
|
} else {
|
||||||
privValidator = types.GenPrivValidator()
|
privValidator = types.GenPrivValidator()
|
||||||
privValidator.SetFile(privValidatorFile)
|
privValidator.SetFile(privValidatorFile)
|
||||||
privValidator.Save()
|
privValidator.Save()
|
||||||
log.Notice("Generated PrivValidator", "file", privValidatorFile)
|
l.Notice("Generated PrivValidator", "file", privValidatorFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue