github.com/Finschia/finschia-sdk@v0.48.1/x/slashing/abci.go (about) 1 package slashing 2 3 import ( 4 "time" 5 6 ocabci "github.com/Finschia/ostracon/abci/types" 7 8 "github.com/Finschia/finschia-sdk/telemetry" 9 sdk "github.com/Finschia/finschia-sdk/types" 10 "github.com/Finschia/finschia-sdk/x/slashing/keeper" 11 "github.com/Finschia/finschia-sdk/x/slashing/types" 12 ) 13 14 // BeginBlocker check for infraction evidence or downtime of validators 15 // on every begin block 16 func BeginBlocker(ctx sdk.Context, req ocabci.RequestBeginBlock, k keeper.Keeper) { 17 defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) 18 19 // Iterate over all the validators which *should* have signed this block 20 // store whether or not they have actually signed it and slash/unbond any 21 // which have missed too many blocks in a row (downtime slashing) 22 for _, voteInfo := range req.LastCommitInfo.GetVotes() { 23 k.HandleValidatorSignature(ctx, voteInfo.Validator.Address, voteInfo.Validator.Power, voteInfo.SignedLastBlock) 24 } 25 }