From 206c0bfc7d18a7a6dbe0d789e14be33cd2f57885 Mon Sep 17 00:00:00 2001 From: ryanchrypto <12519942+ryanchrypto@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:26:26 -0700 Subject: [PATCH] fix: added key when dry-run is true --- client/keys/add.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/keys/add.go b/client/keys/add.go index 19a927f73953..4b4b3b6b9b61 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -88,7 +88,7 @@ func runAddCmdPrepare(cmd *cobra.Command, args []string) error { return err } - return RunAddCmd(clientCtx, cmd, args, buf) + return runAddCmd(clientCtx, cmd, args, buf) } /* @@ -100,7 +100,7 @@ input output - armor encrypted private key (saved to file) */ -func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error { +func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error { var err error name := args[0] @@ -268,6 +268,13 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return err } + if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun { + err = kb.Delete(name) + if err != nil { + return err + } + } + // Recover key from seed passphrase if recover { // Hide mnemonic from output