cosmos-sdk/x/slashing/abci.go

19 lines
689 B
Go
Raw Normal View History

2018-05-23 13:25:56 -07:00
package slashing
import (
abci "github.com/tendermint/tendermint/abci/types"
2018-12-10 06:27:25 -08:00
sdk "github.com/cosmos/cosmos-sdk/types"
2018-05-23 13:25:56 -07:00
)
// BeginBlocker check for infraction evidence or downtime of validators
// on every begin block
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper) {
// Iterate over all the validators which *should* have signed this block
// store whether or not they have actually signed it and slash/unbond any
// which have missed too many blocks in a row (downtime slashing)
for _, voteInfo := range req.LastCommitInfo.GetVotes() {
k.HandleValidatorSignature(ctx, voteInfo.Validator.Address, voteInfo.Validator.Power, voteInfo.SignedLastBlock)
}
2018-05-23 13:25:56 -07:00
}