From 0dae7f8e4c2de90dd39e8f2932dd544c068dafa9 Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Tue, 29 May 2018 02:27:43 +0200 Subject: [PATCH] Panic on revoke/unrevoke nonexistent validator --- x/stake/keeper.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/x/stake/keeper.go b/x/stake/keeper.go index 8775dbef53..d943193a11 100644 --- a/x/stake/keeper.go +++ b/x/stake/keeper.go @@ -799,9 +799,7 @@ func (k Keeper) Revoke(ctx sdk.Context, pubkey crypto.PubKey) { logger := ctx.Logger().With("module", "x/stake") val, found := k.GetValidatorByPubKey(ctx, pubkey) if !found { - // TODO Should we panic? - ctx.Logger().Info("Validator with pubkey %s not found, cannot revoke", pubkey) - return + panic(fmt.Errorf("Validator with pubkey %s not found, cannot revoke", pubkey)) } val.Revoked = true k.updateValidator(ctx, val) // update the validator, now revoked @@ -814,9 +812,7 @@ func (k Keeper) Unrevoke(ctx sdk.Context, pubkey crypto.PubKey) { logger := ctx.Logger().With("module", "x/stake") val, found := k.GetValidatorByPubKey(ctx, pubkey) if !found { - // TODO Should we panic? - ctx.Logger().Info("Validator with pubkey %s not found, cannot unrevoke", pubkey) - return + panic(fmt.Errorf("Validator with pubkey %s not found, cannot unrevoke", pubkey)) } val.Revoked = false k.updateValidator(ctx, val) // update the validator, now unrevoked