github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/builder.go (about)

     1  package module
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  )
     6  
     7  // Builder represents an abstracted block construction module that can be used
     8  // in more than one consensus algorithm. The resulting block is consistent
     9  // within itself and can be wrapped with additional consensus information such
    10  // as QCs.
    11  type Builder interface {
    12  
    13  	// BuildOn generates a new payload that is valid with respect to the parent
    14  	// being built upon, with the view being provided by the consensus algorithm.
    15  	// The builder stores the block and validates it against the protocol state
    16  	// before returning it.
    17  	//
    18  	// NOTE: Since the block is stored within Builder, HotStuff MUST propose the
    19  	// block once BuildOn successfully returns.
    20  	BuildOn(parentID flow.Identifier, setter func(*flow.Header) error, sign func(*flow.Header) error) (*flow.Header, error)
    21  }