Bugfix; update slashing spec
This commit is contained in:
@@ -46,11 +46,7 @@ func handleMsgUnjail(ctx sdk.Context, msg MsgUnjail, k Keeper) sdk.Result {
|
||||
return ErrValidatorJailed(k.codespace).Result()
|
||||
}
|
||||
|
||||
// update the starting height so the validator can't be immediately jailed
|
||||
// again
|
||||
info.StartHeight = ctx.BlockHeight()
|
||||
k.setValidatorSigningInfo(ctx, consAddr, info)
|
||||
|
||||
// unjail the validator
|
||||
k.validatorSet.Unjail(ctx, consAddr)
|
||||
|
||||
tags := sdk.NewTags("action", []byte("unjail"), "validator", []byte(msg.ValidatorAddr.String()))
|
||||
|
||||
+1
-1
@@ -16,8 +16,8 @@ func (k Keeper) onValidatorBonded(ctx sdk.Context, address sdk.ConsAddress) {
|
||||
JailedUntil: time.Unix(0, 0),
|
||||
MissedBlocksCounter: 0,
|
||||
}
|
||||
k.setValidatorSigningInfo(ctx, address, signingInfo)
|
||||
}
|
||||
k.setValidatorSigningInfo(ctx, address, signingInfo)
|
||||
|
||||
// Create a new slashing period when a validator is bonded
|
||||
slashingPeriod := ValidatorSlashingPeriod{
|
||||
|
||||
@@ -245,10 +245,10 @@ func TestHandleAbsentValidator(t *testing.T) {
|
||||
pool = sk.GetPool(ctx)
|
||||
require.Equal(t, amtInt-slashAmt-secondSlashAmt, pool.BondedTokens.RoundInt64())
|
||||
|
||||
// validator start height should have been changed
|
||||
// validator start height should not have been changed
|
||||
info, found = keeper.getValidatorSigningInfo(ctx, sdk.ConsAddress(val.Address()))
|
||||
require.True(t, found)
|
||||
require.Equal(t, height, info.StartHeight)
|
||||
require.Equal(t, int64(0), info.StartHeight)
|
||||
// we've missed 2 blocks more than the maximum, so the counter was reset to 0 at 1 block more and is now 1
|
||||
require.Equal(t, int64(1), info.MissedBlocksCounter)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user