github.com/koko1123/flow-go-1@v0.29.6/consensus/hotstuff/validator.go (about)

     1  package hotstuff
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/consensus/hotstuff/model"
     5  	"github.com/koko1123/flow-go-1/model/flow"
     6  )
     7  
     8  // Validator provides functions to validate QC, proposals and votes.
     9  type Validator interface {
    10  
    11  	// ValidateQC checks the validity of a QC for a given block.
    12  	// During normal operations, the following error returns are expected:
    13  	//  * model.InvalidBlockError if the QC is invalid
    14  	ValidateQC(qc *flow.QuorumCertificate, block *model.Block) error
    15  
    16  	// ValidateProposal checks the validity of a proposal.
    17  	// During normal operations, the following error returns are expected:
    18  	//  * model.InvalidBlockError if the block is invalid
    19  	ValidateProposal(proposal *model.Proposal) error
    20  
    21  	// ValidateVote checks the validity of a vote for a given block and
    22  	// returns the full entity for the voter. During normal operations,
    23  	// the following errors are expected:
    24  	//  * model.InvalidVoteError for invalid votes
    25  	ValidateVote(vote *model.Vote, block *model.Block) (*flow.Identity, error)
    26  }