Add some explanatory comments

This commit is contained in:
Christopher Goes
2018-05-29 00:10:52 +02:00
parent 26f22dbe4d
commit f4f8cc66d9
5 changed files with 44 additions and 11 deletions
+6
View File
@@ -16,7 +16,11 @@ func NewHandler(k Keeper) sdk.Handler {
}
}
// Validators must submit a transaction to unrevoke themselves after
// having been revoked (and thus unbonded) for downtime
func handleMsgUnrevoke(ctx sdk.Context, msg MsgUnrevoke, k Keeper) sdk.Result {
// Validator must exist
validator := k.stakeKeeper.Validator(ctx, msg.ValidatorAddr)
if validator == nil {
return ErrNoValidatorForAddress(k.codespace).Result()
@@ -24,11 +28,13 @@ func handleMsgUnrevoke(ctx sdk.Context, msg MsgUnrevoke, k Keeper) sdk.Result {
addr := validator.GetPubKey().Address()
// Signing info must exist
info, found := k.getValidatorSigningInfo(ctx, addr)
if !found {
return ErrNoValidatorForAddress(k.codespace).Result()
}
// Cannot be unrevoked until out of jail
if ctx.BlockHeader().Time < info.JailedUntil {
return ErrValidatorJailed(k.codespace).Result()
}