Merge PR #3546: Min Self Delegation
This commit is contained in:
committed by
Jack Zampolin
parent
ba63eb1801
commit
cff985ffc5
@@ -126,6 +126,8 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k
|
||||
return err.Result()
|
||||
}
|
||||
|
||||
validator.MinSelfDelegation = msg.MinSelfDelegation
|
||||
|
||||
k.SetValidator(ctx, validator)
|
||||
k.SetValidatorByConsAddr(ctx, validator)
|
||||
k.SetNewValidatorByPowerIndex(ctx, validator)
|
||||
@@ -178,6 +180,16 @@ func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keepe
|
||||
validator.Commission = commission
|
||||
}
|
||||
|
||||
if msg.MinSelfDelegation != nil {
|
||||
if !(*msg.MinSelfDelegation).GT(validator.MinSelfDelegation) {
|
||||
return ErrMinSelfDelegationDecreased(k.Codespace()).Result()
|
||||
}
|
||||
if (*msg.MinSelfDelegation).GT(validator.Tokens) {
|
||||
return ErrSelfDelegationBelowMinimum(k.Codespace()).Result()
|
||||
}
|
||||
validator.MinSelfDelegation = (*msg.MinSelfDelegation)
|
||||
}
|
||||
|
||||
k.SetValidator(ctx, validator)
|
||||
|
||||
tags := sdk.NewTags(
|
||||
|
||||
Reference in New Issue
Block a user