blockpool

package
v0.0.0-...-8d456d7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockNode

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

BlockNode save one block and its children

func (*BlockNode) GetBlock

func (bn *BlockNode) GetBlock() *common.Block

GetBlock get block

func (*BlockNode) GetChildren

func (bn *BlockNode) GetChildren() []string

GetChildren get children

type BlockPool

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

BlockPool store block and qc in memory

func NewBlockPool

func NewBlockPool(rootBlock *common.Block,
	rootQC *maxbftpb.QuorumCert) *BlockPool

NewBlockPool init a block pool with rootBlock, rootQC and maxPrunedSize

func (*BlockPool) BranchFromRoot

func (bp *BlockPool) BranchFromRoot(block *common.Block) []*common.Block

BranchFromRoot get branch from root to input block

func (*BlockPool) Details

func (bp *BlockPool) Details() string

func (*BlockPool) GetBlockByID

func (bp *BlockPool) GetBlockByID(id string) *common.Block

GetBlockByID get block by block hash

func (*BlockPool) GetBlocks

func (bp *BlockPool) GetBlocks(height uint64) []*common.Block

func (*BlockPool) GetHighestCertifiedBlock

func (bp *BlockPool) GetHighestCertifiedBlock() *common.Block

GetHighestCertifiedBlock get highest certified block

func (*BlockPool) GetHighestQC

func (bp *BlockPool) GetHighestQC() *maxbftpb.QuorumCert

GetHighestQC get highest qc

func (*BlockPool) GetQCByID

func (bp *BlockPool) GetQCByID(id string) *maxbftpb.QuorumCert

GetQCByID get qc by block hash

func (*BlockPool) GetRootBlock

func (bp *BlockPool) GetRootBlock() *common.Block

GetRootBlock get root block

func (*BlockPool) GetRootQC

func (bp *BlockPool) GetRootQC() *maxbftpb.QuorumCert

func (*BlockPool) InsertBlock

func (bp *BlockPool) InsertBlock(block *common.Block) error

InsertBlock insert block to block pool

func (*BlockPool) InsertQC

func (bp *BlockPool) InsertQC(qc *maxbftpb.QuorumCert) error

InsertQC store qc

func (*BlockPool) PruneBlock

func (bp *BlockPool) PruneBlock(newRootID string)

PruneBlock prune block

type BlockTree

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

BlockTree maintains a consistent block tree of parent and children links this struct is not thread safety.

func NewBlockTree

func NewBlockTree(rootBlock *common.Block, rootQC *maxbft.QuorumCert) *BlockTree

NewBlockTree init a block tree with rootBlock, rootQC and maxPrunedSize

func (*BlockTree) BranchFromRoot

func (bt *BlockTree) BranchFromRoot(block *common.Block) []*common.Block

BranchFromRoot get branch from root to input block

func (*BlockTree) Details

func (bt *BlockTree) Details() string

func (*BlockTree) GetBlockByID

func (bt *BlockTree) GetBlockByID(id string) *common.Block

GetBlockByID get block by block hash

func (*BlockTree) GetBlocks

func (bt *BlockTree) GetBlocks(height uint64) []*common.Block

func (*BlockTree) GetRootBlock

func (bt *BlockTree) GetRootBlock() *common.Block

GetRootBlock get root block from tree

func (*BlockTree) GetRootQC

func (bt *BlockTree) GetRootQC() *maxbft.QuorumCert

func (*BlockTree) InsertBlock

func (bt *BlockTree) InsertBlock(block *common.Block) error

InsertBlock insert block to tree

func (*BlockTree) PruneBlock

func (bt *BlockTree) PruneBlock(newRootId string, newRootQC *maxbft.QuorumCert) []string

PruneBlock prune block and update rootBlock

Jump to

Keyboard shortcuts

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