Documentation ¶
Index ¶
- type BlockNode
- type BlockPool
- func (bp *BlockPool) BranchFromRoot(block *common.Block) []*common.Block
- func (bp *BlockPool) Details() string
- func (bp *BlockPool) GetBlockByID(id string) *common.Block
- func (bp *BlockPool) GetBlocks(height uint64) []*common.Block
- func (bp *BlockPool) GetHighestCertifiedBlock() *common.Block
- func (bp *BlockPool) GetHighestQC() *maxbftpb.QuorumCert
- func (bp *BlockPool) GetQCByID(id string) *maxbftpb.QuorumCert
- func (bp *BlockPool) GetRootBlock() *common.Block
- func (bp *BlockPool) GetRootQC() *maxbftpb.QuorumCert
- func (bp *BlockPool) InsertBlock(block *common.Block) error
- func (bp *BlockPool) InsertQC(qc *maxbftpb.QuorumCert) error
- func (bp *BlockPool) PruneBlock(newRootID string)
- type BlockTree
- func (bt *BlockTree) BranchFromRoot(block *common.Block) []*common.Block
- func (bt *BlockTree) Details() string
- func (bt *BlockTree) GetBlockByID(id string) *common.Block
- func (bt *BlockTree) GetBlocks(height uint64) []*common.Block
- func (bt *BlockTree) GetRootBlock() *common.Block
- func (bt *BlockTree) GetRootQC() *maxbft.QuorumCert
- func (bt *BlockTree) InsertBlock(block *common.Block) error
- func (bt *BlockTree) PruneBlock(newRootId string, newRootQC *maxbft.QuorumCert) []string
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) GetChildren ¶
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 ¶
BranchFromRoot get branch from root to input block
func (*BlockPool) GetBlockByID ¶
GetBlockByID get block by block hash
func (*BlockPool) GetHighestCertifiedBlock ¶
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 ¶
GetRootBlock get root block
func (*BlockPool) GetRootQC ¶
func (bp *BlockPool) GetRootQC() *maxbftpb.QuorumCert
func (*BlockPool) InsertBlock ¶
InsertBlock insert block to block pool
func (*BlockPool) InsertQC ¶
func (bp *BlockPool) InsertQC(qc *maxbftpb.QuorumCert) error
InsertQC store qc
func (*BlockPool) PruneBlock ¶
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 ¶
BranchFromRoot get branch from root to input block
func (*BlockTree) GetBlockByID ¶
GetBlockByID get block by block hash
func (*BlockTree) GetRootBlock ¶
GetRootBlock get root block from tree
func (*BlockTree) GetRootQC ¶
func (bt *BlockTree) GetRootQC() *maxbft.QuorumCert
func (*BlockTree) InsertBlock ¶
InsertBlock insert block to tree
func (*BlockTree) PruneBlock ¶
func (bt *BlockTree) PruneBlock(newRootId string, newRootQC *maxbft.QuorumCert) []string
PruneBlock prune block and update rootBlock