From a9feeaf77efa90a125e8cb62bc881f00c203d3c0 Mon Sep 17 00:00:00 2001 From: mariko Date: Wed, 17 Feb 2021 12:10:36 +0900 Subject: [PATCH 1/2] fix: A bug fix --- cmd/tendermint/commands/reset_priv_validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/tendermint/commands/reset_priv_validator.go b/cmd/tendermint/commands/reset_priv_validator.go index db7dbeaf6..70f4a8a68 100644 --- a/cmd/tendermint/commands/reset_priv_validator.go +++ b/cmd/tendermint/commands/reset_priv_validator.go @@ -35,7 +35,7 @@ var ResetPrivValidatorCmd = &cobra.Command{ // it's only suitable for testnets. func resetAll(cmd *cobra.Command, args []string) { ResetAll(config.DBDir(), config.P2P.AddrBookFile(), config.PrivValidatorKeyFile(), - config.PrivValidatorKeyType(), config.PrivValidatorStateFile(), logger) + config.PrivValidatorStateFile(), config.PrivValidatorKeyType(), logger) } // XXX: this is totally unsafe. From 4c50f8dc15f163785312875b3ca6c3eb17f954aa Mon Sep 17 00:00:00 2001 From: mariko Date: Wed, 17 Feb 2021 12:14:41 +0900 Subject: [PATCH 2/2] feat: add an option for selecting priv key type to `unsafe_reset_all`, `unsafe_reset_priv_validator`, and `gen_validator` --- cmd/tendermint/commands/gen_validator.go | 7 ++++++- cmd/tendermint/commands/reset_priv_validator.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/tendermint/commands/gen_validator.go b/cmd/tendermint/commands/gen_validator.go index be6508991..ece3c72a6 100644 --- a/cmd/tendermint/commands/gen_validator.go +++ b/cmd/tendermint/commands/gen_validator.go @@ -16,8 +16,13 @@ var GenValidatorCmd = &cobra.Command{ Run: genValidator, } +func init() { + GenValidatorCmd.Flags().String("priv_key_type", config.PrivKeyType, + "Specify validator's private key type (ed25519 | composite)") +} + func genValidator(cmd *cobra.Command, args []string) { - pv, _ := privval.GenFilePV("", "", privval.PrivKeyTypeEd25519) + pv, _ := privval.GenFilePV("", "", config.PrivKeyType) jsbz, err := cdc.MarshalJSON(pv) if err != nil { panic(err) diff --git a/cmd/tendermint/commands/reset_priv_validator.go b/cmd/tendermint/commands/reset_priv_validator.go index 70f4a8a68..5633ff23f 100644 --- a/cmd/tendermint/commands/reset_priv_validator.go +++ b/cmd/tendermint/commands/reset_priv_validator.go @@ -22,6 +22,10 @@ var keepAddrBook bool func init() { ResetAllCmd.Flags().BoolVar(&keepAddrBook, "keep-addr-book", false, "Keep the address book intact") + ResetAllCmd.Flags().String("priv_key_type", config.PrivKeyType, + "Specify validator's private key type (ed25519 | composite)") + ResetPrivValidatorCmd.Flags().String("priv_key_type", config.PrivKeyType, + "Specify validator's private key type (ed25519 | composite)") } // ResetPrivValidatorCmd resets the private validator files.