From 664ac39f17dc5fb2020443818c7f99ce2a00561c Mon Sep 17 00:00:00 2001 From: Cha Minkyoo Date: Sat, 5 Oct 2019 22:05:35 +0900 Subject: [PATCH] Disallow CreateValidator --- x/staking/types/errors.go | 4 ++++ x/staking/types/msg.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x/staking/types/errors.go b/x/staking/types/errors.go index 012f9421f8ee..4db9095bab4c 100644 --- a/x/staking/types/errors.go +++ b/x/staking/types/errors.go @@ -212,3 +212,7 @@ func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error { func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error { return sdk.NewError(codespace, CodeInvalidValidator, "missing signature") } + +func ErrNotAllowed(codespace sdk.CodespaceType) sdk.Error { + return sdk.NewError(codespace, CodeUnauthorized, "not allowed") +} diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 9bf839fa2443..0f2bf6a2b668 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -146,7 +146,8 @@ func (msg MsgCreateValidator) ValidateBasic() sdk.Error { return ErrSelfDelegationBelowMinimum(DefaultCodespace) } - return nil + //return nil + return ErrNotAllowed(DefaultCodespace) } // MsgEditValidator - struct for editing a validator