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

     1  package forks
     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  // ForkChoice determines the fork-choice.
     9  // ForkChoice directly interfaces with the Finalizer to query required information
    10  // (such as finalized View, stored block, etc).
    11  type ForkChoice interface {
    12  
    13  	// AddQC adds a Quorum Certificate to Forks;
    14  	// Errors in case the block referenced by the qc is unknown.
    15  	AddQC(qc *flow.QuorumCertificate) error
    16  
    17  	// MakeForkChoice prompts the ForkChoice to generate a fork choice for the
    18  	// current view `curView`. The fork choice is a qc that should be used for
    19  	// building the primaries block.
    20  	//
    21  	// Error return indicates incorrect usage. Processing a QC with view v
    22  	// should result in the PaceMaker being in view v+1 or larger. Hence, given
    23  	// that the current View is curView, all QCs should have view < curView
    24  	MakeForkChoice(curView uint64) (*flow.QuorumCertificate, *model.Block, error)
    25  }