Browse Source

cli: add option to not clear address book with unsafe reset (#3606)

Fixes #3585
pull/3609/head
Ivan Kushmantsev 6 years ago
committed by Anton Kaliaev
parent
commit
a2a68df521
2 changed files with 12 additions and 1 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +11
    -1
      cmd/tendermint/commands/reset_priv_validator.go

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -20,6 +20,7 @@
### IMPROVEMENTS:
- [rpc] [\#3534](https://github.com/tendermint/tendermint/pull/3534) Add support for batched requests/responses in JSON RPC
- [cli] \#3606 (https://github.com/tendermint/tendermint/issues/3585) Add option to not clear address book with unsafe reset (@climber73)
- [cli] [\#3160](https://github.com/tendermint/tendermint/issues/3160) Add `-config=<path-to-config>` option to `testnet` cmd (@gregdhill)
- [cs/replay] \#3460 check appHash for each block


+ 11
- 1
cmd/tendermint/commands/reset_priv_validator.go View File

@ -18,6 +18,12 @@ var ResetAllCmd = &cobra.Command{
Run: resetAll,
}
var keepAddrBook bool
func init() {
ResetAllCmd.Flags().BoolVar(&keepAddrBook, "keep-addr-book", false, "Keep the address book intact")
}
// ResetPrivValidatorCmd resets the private validator files.
var ResetPrivValidatorCmd = &cobra.Command{
Use: "unsafe_reset_priv_validator",
@ -41,7 +47,11 @@ func resetPrivValidator(cmd *cobra.Command, args []string) {
// ResetAll removes address book files plus all data, and resets the privValdiator data.
// Exported so other CLI tools can use it.
func ResetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logger log.Logger) {
removeAddrBook(addrBookFile, logger)
if keepAddrBook {
logger.Info("The address book remains intact")
} else {
removeAddrBook(addrBookFile, logger)
}
if err := os.RemoveAll(dbDir); err == nil {
logger.Info("Removed all blockchain history", "dir", dbDir)
} else {


Loading…
Cancel
Save