From 4faa8b72aadb01c03636c9643f6956299fb2eb0c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 1 Jun 2022 18:34:35 +0200 Subject: [PATCH] cmd: don't used global config for reset commands (#8668) --- cmd/tendermint/commands/reset.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cmd/tendermint/commands/reset.go b/cmd/tendermint/commands/reset.go index 1f6c42d57..543cdfe93 100644 --- a/cmd/tendermint/commands/reset.go +++ b/cmd/tendermint/commands/reset.go @@ -27,6 +27,11 @@ var ResetStateCmd = &cobra.Command{ Use: "reset-state", Short: "Remove all the data and WAL", RunE: func(cmd *cobra.Command, args []string) error { + config, err := ParseConfig() + if err != nil { + return err + } + return resetState(config.DBDir(), logger, keyType) }, } @@ -47,13 +52,27 @@ var ResetPrivValidatorCmd = &cobra.Command{ // XXX: this is totally unsafe. // it's only suitable for testnets. func resetAllCmd(cmd *cobra.Command, args []string) error { - return resetAll(config.DBDir(), config.P2P.AddrBookFile(), config.PrivValidator.KeyFile(), - config.PrivValidator.StateFile(), logger) + config, err := ParseConfig() + if err != nil { + return err + } + + return resetAll( + config.DBDir(), + config.P2P.AddrBookFile(), + config.PrivValidator.KeyFile(), + config.PrivValidator.StateFile(), + logger, + ) } // XXX: this is totally unsafe. // it's only suitable for testnets. func resetPrivValidator(cmd *cobra.Command, args []string) error { + config, err := ParseConfig() + if err != nil { + return err + } return resetFilePV(config.PrivValidator.KeyFile(), config.PrivValidator.StateFile(), logger, keyType) }