Documentation
¶
Index ¶
- type BlockQC
- type Finalizer
- type ForkChoice
- type Forks
- func (f *Forks) AddBlock(block *model.Block) error
- func (f *Forks) AddQC(qc *flow.QuorumCertificate) error
- func (f *Forks) FinalizedBlock() *model.Block
- func (f *Forks) FinalizedView() uint64
- func (f *Forks) GetBlock(id flow.Identifier) (*model.Block, bool)
- func (f *Forks) GetBlocksForView(view uint64) []*model.Block
- func (f *Forks) IsSafeBlock(block *model.Block) bool
- func (f *Forks) MakeForkChoice(curView uint64) (*flow.QuorumCertificate, *model.Block, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockQC ¶
type BlockQC struct {
Block *model.Block
QC *flow.QuorumCertificate
}
BlockQC is a Block with a QC that pointing to it, meaning a Quorum Certified Block. This implies Block.View == QC.View && Block.BlockID == QC.BlockID
type Finalizer ¶
type Finalizer interface {
VerifyBlock(*model.Block) error
IsSafeBlock(*model.Block) bool
AddBlock(*model.Block) error
GetBlock(blockID flow.Identifier) (*model.Block, bool)
GetBlocksForView(view uint64) []*model.Block
FinalizedBlock() *model.Block
LockedBlock() *model.Block
}
Finalizer is responsible for block finalization.
type ForkChoice ¶
type ForkChoice interface {
// AddQC adds a Quorum Certificate to Forks;
// Errors in case the block referenced by the qc is unknown.
AddQC(qc *flow.QuorumCertificate) error
// MakeForkChoice prompts the ForkChoice to generate a fork choice for the
// current view `curView`. The fork choice is a qc that should be used for
// building the primaries block.
//
// Error return indicates incorrect usage. Processing a QC with view v
// should result in the PaceMaker being in view v+1 or larger. Hence, given
// that the current View is curView, all QCs should have view < curView
MakeForkChoice(curView uint64) (*flow.QuorumCertificate, *model.Block, error)
}
ForkChoice determines the fork-choice. ForkChoice directly interfaces with the Finalizer to query required information (such as finalized View, stored block, etc).
type Forks ¶
type Forks struct {
// contains filtered or unexported fields
}
Forks implements the hotstuff.Reactor API
func (*Forks) AddBlock ¶
AddBlock passes the block to the finalizer for finalization and gives the QC to forkchoice for updating the preferred parent block
func (*Forks) AddQC ¶
func (f *Forks) AddQC(qc *flow.QuorumCertificate) error
AddQC gives the QC to the forkchoice for updating the preferred parent block
func (*Forks) FinalizedBlock ¶
FinalizedBlock returns the latest finalized block
func (*Forks) FinalizedView ¶
FinalizedView returns the view of the latest finalized block
func (*Forks) GetBlocksForView ¶
GetBlocksForView returns all the blocks for a certain view.
func (*Forks) IsSafeBlock ¶
IsSafeBlock returns whether a block is safe to vote for.
func (*Forks) MakeForkChoice ¶
MakeForkChoice returns the block to build new block proposal from for the current view. the QC is the QC that points to that block.