finalizer

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPrunedAncestry = errors.New("cannot resolve pruned ancestor")

ErrPrunedAncestry is a sentinel error: cannot resolve ancestry of block due to pruning

Functions

This section is empty.

Types

type BlockContainer

type BlockContainer struct {
	Block *model.Block
}

BlockContainer wraps a block to implement forest.Vertex In addition, it holds some additional properties for efficient processing of blocks by the Finalizer

func (*BlockContainer) Level

func (b *BlockContainer) Level() uint64

func (*BlockContainer) Parent

func (b *BlockContainer) Parent() (flow.Identifier, uint64)

func (*BlockContainer) VertexID

func (b *BlockContainer) VertexID() flow.Identifier

functions implementing forest.vertex

type Finalizer

type Finalizer struct {
	// contains filtered or unexported fields
}

Finalizer implements HotStuff finalization logic

func New

func New(trustedRoot *forks.BlockQC, finalizationCallback module.Finalizer, notifier hotstuff.FinalizationConsumer) (*Finalizer, error)

func (*Finalizer) AddBlock

func (r *Finalizer) AddBlock(block *model.Block) error

ProcessBlock adds `block` to the consensus state. Calling this method with previously-processed blocks leaves the consensus state invariant (though, it will potentially cause some duplicate processing). UNVALIDATED: expects block to pass Finalizer.VerifyBlock(block)

func (*Finalizer) FinalizedBlock

func (r *Finalizer) FinalizedBlock() *model.Block

func (*Finalizer) FinalizedBlockQC

func (r *Finalizer) FinalizedBlockQC() *flow.QuorumCertificate

func (*Finalizer) FinalizedView

func (r *Finalizer) FinalizedView() uint64

func (*Finalizer) GetBlock

func (r *Finalizer) GetBlock(blockID flow.Identifier) (*model.Block, bool)

GetBlock returns block for given ID

func (*Finalizer) GetBlocksForView

func (r *Finalizer) GetBlocksForView(view uint64) []*model.Block

GetBlock returns all known blocks for the given

func (*Finalizer) IsKnownBlock

func (r *Finalizer) IsKnownBlock(block *model.Block) bool

IsKnownBlock checks whether block is known. UNVALIDATED: expects block to pass Finalizer.VerifyBlock(block)

func (*Finalizer) IsProcessingNeeded

func (r *Finalizer) IsProcessingNeeded(block *model.Block) bool

IsProcessingNeeded performs basic checks whether or not block needs processing only considering the block's height and hash Returns false if any of the following conditions applies

  • block view is _below_ the most recently finalized block
  • known block

UNVALIDATED: expects block to pass Finalizer.VerifyBlock(block)

func (*Finalizer) IsSafeBlock

func (r *Finalizer) IsSafeBlock(block *model.Block) bool

IsSafeBlock returns true if block is safe to vote for (according to the definition in https://arxiv.org/abs/1803.05069v6). NO MODIFICATION of consensus state (read only) UNVALIDATED: expects block to pass Finalizer.VerifyBlock(block)

func (*Finalizer) LockedBlock

func (r *Finalizer) LockedBlock() *model.Block

func (*Finalizer) LockedBlockQC

func (r *Finalizer) LockedBlockQC() *flow.QuorumCertificate

func (*Finalizer) VerifyBlock

func (r *Finalizer) VerifyBlock(block *model.Block) error

VerifyBlock checks block for validity

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL