github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/slashing/abci.go (about)

     1  package slashing
     2  
     3  import (
     4  	abci "github.com/fibonacci-chain/fbc/libs/tendermint/abci/types"
     5  
     6  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     7  )
     8  
     9  // BeginBlocker check for infraction evidence or downtime of validators
    10  // on every begin block
    11  func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k Keeper) {
    12  	// Iterate over all the validators which *should* have signed this block
    13  	// store whether or not they have actually signed it and slash/unbond any
    14  	// which have missed too many blocks in a row (downtime slashing)
    15  	for _, voteInfo := range req.LastCommitInfo.GetVotes() {
    16  		k.HandleValidatorSignature(ctx, voteInfo.Validator.Address, voteInfo.Validator.Power, voteInfo.SignedLastBlock)
    17  	}
    18  }