From 754bab8674ef3650572d3eb39e0976fb519066cf Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Thu, 25 Apr 2024 20:02:58 +0700 Subject: [PATCH] refactor --- x/authz/keeper/keeper.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index a0a60e73d62d..396209cf611f 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -267,15 +267,15 @@ func (k Keeper) DeleteAllGrants(ctx context.Context, granter sdk.AccAddress) err if err != nil { return err } + if len(keysToDelete) == 0 { + return errorsmod.Wrapf(authz.ErrNoAuthorizationFound, "no grants found for granter %s", granter) + } for _, key := range keysToDelete { _, granteeAddr, msgType := parseGrantStoreKey([]byte(key)) if err := k.DeleteGrant(ctx, granteeAddr, granter, msgType); err != nil { return err } } - if len(keysToDelete) == 0 { - return errorsmod.Wrapf(authz.ErrNoAuthorizationFound, "no grants found for granter %s", granter) - } return k.EventService.EventManager(ctx).Emit(&authz.EventRevokeAll{ Granter: granter.String(), })