Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an option for selecting priv key type to unsafe_reset_all, unsafe_reset_priv_validator, and gen_validator #186

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/tendermint/commands/gen_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion cmd/tendermint/commands/reset_priv_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -35,7 +39,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.
Expand Down