From 9dfbecc61126a18b77ff52ef4c2e6e3e39da22a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Mon, 27 Nov 2023 13:08:53 +0100 Subject: [PATCH 1/2] fix(client/keys): don't return when key not found in keys delete (#18562) --- client/keys/delete.go | 3 ++- client/keys/delete_test.go | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/keys/delete.go b/client/keys/delete.go index b9e182a4c6..532e14edd0 100644 --- a/client/keys/delete.go +++ b/client/keys/delete.go @@ -37,7 +37,8 @@ private keys stored in a ledger device cannot be deleted with the CLI. for _, name := range args { info, err := clientCtx.Keyring.Key(name) if err != nil { - return err + cmd.PrintErrf("key %s not found\n", name) + continue } // confirm deletion, unless -y is passed diff --git a/client/keys/delete_test.go b/client/keys/delete_test.go index afb1c0fb0f..2a4bf397fd 100644 --- a/client/keys/delete_test.go +++ b/client/keys/delete_test.go @@ -51,8 +51,7 @@ func Test_runDeleteCmd(t *testing.T) { ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx) err = cmd.ExecuteContext(ctx) - require.Error(t, err) - require.EqualError(t, err, "blah.info: key not found") + require.NoError(t, err) // User confirmation missing cmd.SetArgs([]string{ From 495b1f822a5dd1d6394d072accb1d078544d9bd2 Mon Sep 17 00:00:00 2001 From: 170210 Date: Wed, 27 Mar 2024 17:20:09 +0900 Subject: [PATCH 2/2] chore: update CHANGLOG.md Signed-off-by: 170210 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d95306b37..54f23cae2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/staking) [\#1301](https://github.com/Finschia/finschia-sdk/pull/1301) Use bytes instead of string comparison in delete validator queue (backport cosmos/cosmos-sdk#12303) * (x/gov) [\#1304](https://github.com/Finschia/finschia-sdk/pull/1304) fetch a failed proposal tally from proposal.FinalTallyResult in the gprc query * (x/staking) [\#1306](https://github.com/Finschia/finschia-sdk/pull/1306) add validation for potential slashing evasion during re-delegation +* (client/keys) [#1312](https://github.com/Finschia/finschia-sdk/pull/1312) ignore error when key not found in `keys delete` ### Removed