Merge PR #4600: Check Denom when (Un|Re)delegating
This commit is contained in:
committed by
Alexander Bezobchuk
parent
6d5ca0b4f1
commit
eda558bc7e
+10
-2
@@ -107,7 +107,7 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k
|
||||
return ErrValidatorPubKeyExists(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
if msg.Value.Denom != k.GetParams(ctx).BondDenom {
|
||||
if msg.Value.Denom != k.BondDenom(ctx) {
|
||||
return ErrBadDenom(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.Keeper)
|
||||
return ErrNoValidatorFound(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
if msg.Amount.Denom != k.GetParams(ctx).BondDenom {
|
||||
if msg.Amount.Denom != k.BondDenom(ctx) {
|
||||
return ErrBadDenom(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
@@ -244,6 +244,10 @@ func handleMsgUndelegate(ctx sdk.Context, msg types.MsgUndelegate, k keeper.Keep
|
||||
return err.Result()
|
||||
}
|
||||
|
||||
if msg.Amount.Denom != k.BondDenom(ctx) {
|
||||
return ErrBadDenom(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
completionTime, err := k.Undelegate(ctx, msg.DelegatorAddress, msg.ValidatorAddress, shares)
|
||||
if err != nil {
|
||||
return err.Result()
|
||||
@@ -268,6 +272,10 @@ func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k k
|
||||
return err.Result()
|
||||
}
|
||||
|
||||
if msg.Amount.Denom != k.BondDenom(ctx) {
|
||||
return ErrBadDenom(k.Codespace()).Result()
|
||||
}
|
||||
|
||||
completionTime, err := k.BeginRedelegation(
|
||||
ctx, msg.DelegatorAddress, msg.ValidatorSrcAddress, msg.ValidatorDstAddress, shares,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user