Check self-delegation against provided minimum

This commit is contained in:
Csongor Kiss 2022-07-22 14:05:10 -05:00 committed by Csongor Kiss
parent abbed8593e
commit 443c6c1f7a
2 changed files with 8 additions and 0 deletions

View File

@ -160,6 +160,10 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida
return nil, types.ErrMinSelfDelegationDecreased
}
if msg.MinSelfDelegation.GT(validator.Tokens) {
return nil, types.ErrSelfDelegationBelowMinimum
}
validator.MinSelfDelegation = (*msg.MinSelfDelegation)
}

View File

@ -129,6 +129,10 @@ func (msg MsgCreateValidator) ValidateBasic() error {
return err
}
if !msg.Value.Amount.GTE(msg.MinSelfDelegation) {
return ErrSelfDelegationBelowMinimum
}
return nil
}