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

     1  package hotstuff
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/consensus/hotstuff/model"
     5  )
     6  
     7  // Voter produces votes for the given block according to voting rules.
     8  type Voter interface {
     9  	// ProduceVoteIfVotable takes a block and current view, and decides whether to vote for the block.
    10  	// Returns:
    11  	//  * (vote, nil): On the _first_ block for the current view that is safe to vote for.
    12  	//    Subsequently, voter does _not_ vote for any other block with the same (or lower) view.
    13  	//  * (nil, model.NoVoteError): If the voter decides that it does not want to vote for the given block.
    14  	//    This is a sentinel error and _expected_ during normal operation.
    15  	// All other errors are unexpected and potential symptoms of uncovered edge cases or corrupted internal state (fatal).
    16  	ProduceVoteIfVotable(block *model.Block, curView uint64) (*model.Vote, error)
    17  }