Documentation ¶
Index ¶
- Variables
- func GetConstructor(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, ...) consensus.Constructor
- func GetName() string
- func Init(bpCount uint16)
- func InitVPR(sdb *state.StateDB) error
- func New(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, ...) (consensus.Consensus, error)
- func ValidateGenesis(genesis *types.Genesis) error
- type BlockFactory
- type DPoS
- func (dpos *DPoS) BlockFactory() consensus.BlockFactory
- func (dpos *DPoS) ClusterInfo(bestBlockHash []byte) *types.GetClusterInfoResponse
- func (dpos *DPoS) ConfChange(req *types.MembershipChange) (*consensus.Member, error)
- func (dpos *DPoS) ConfChangeInfo(requestID uint64) (*types.ConfChangeProgress, error)
- func (dpos *DPoS) ConsensusInfo() *types.ConsensusInfo
- func (dpos *DPoS) GetType() consensus.ConsensusType
- func (dpos *DPoS) HasWAL() bool
- func (dpos *DPoS) IsBlockValid(block *types.Block, bestBlock *types.Block) error
- func (dpos *DPoS) IsConnectedBlock(block *types.Block) bool
- func (dpos *DPoS) IsForkEnable() bool
- func (dpos *DPoS) IsTransactionValid(tx *types.Tx) bool
- func (dpos *DPoS) MakeConfChangeProposal(req *types.MembershipChange) (*consensus.ConfChangePropose, error)
- func (dpos *DPoS) NeedNotify() bool
- func (dpos *DPoS) QueueJob(now time.Time, jq chan<- interface{})
- func (dpos *DPoS) QuitChan() chan interface{}
- func (dpos *DPoS) RaftAccessor() consensus.AergoRaftAccessor
- func (dpos *DPoS) Ticker() *time.Ticker
- func (dpos *DPoS) VerifySign(block *types.Block) error
- func (dpos *DPoS) VerifyTimestamp(block *types.Block) bool
- type Status
Constants ¶
This section is empty.
Variables ¶
var LibStatusKey = []byte("dpos.LibStatus")
LibStatusKey is the key when a LIB information is put into the chain DB.
Functions ¶
func GetConstructor ¶
func GetConstructor(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, sdb *state.ChainStateDB) consensus.Constructor
GetConstructor build and returns consensus.Constructor from New function.
func New ¶
func New(cfg *config.Config, hub *component.ComponentHub, cdb consensus.ChainDB, sdb *state.ChainStateDB) (consensus.Consensus, error)
New returns a new DPos object
func ValidateGenesis ¶
Types ¶
type BlockFactory ¶
type BlockFactory struct { *component.ComponentHub ID string // contains filtered or unexported fields }
BlockFactory is the main data structure for DPoS block factory.
func NewBlockFactory ¶
func NewBlockFactory( hub *component.ComponentHub, sdb *state.ChainStateDB, quitC <-chan interface{}, bv types.BlockVersionner, noTTE bool, ) *BlockFactory
NewBlockFactory returns a new BlockFactory
func (*BlockFactory) JobQueue ¶
func (bf *BlockFactory) JobQueue() chan<- interface{}
JobQueue returns the queue for block production triggering.
func (*BlockFactory) Start ¶
func (bf *BlockFactory) Start()
Start run a DPoS block factory service.
type DPoS ¶
type DPoS struct { *Status consensus.ChainDB *component.ComponentHub // contains filtered or unexported fields }
DPoS is the main data structure of DPoS consensus
func (*DPoS) BlockFactory ¶
func (dpos *DPoS) BlockFactory() consensus.BlockFactory
BlockFactory returns the BlockFactory interface in dpos.
func (*DPoS) ClusterInfo ¶
func (dpos *DPoS) ClusterInfo(bestBlockHash []byte) *types.GetClusterInfoResponse
func (*DPoS) ConfChange ¶
func (*DPoS) ConfChangeInfo ¶
func (dpos *DPoS) ConfChangeInfo(requestID uint64) (*types.ConfChangeProgress, error)
func (*DPoS) ConsensusInfo ¶
func (dpos *DPoS) ConsensusInfo() *types.ConsensusInfo
ConsensusInfo returns the basic DPoS-related info.
func (*DPoS) GetType ¶
func (dpos *DPoS) GetType() consensus.ConsensusType
func (*DPoS) IsBlockValid ¶
IsBlockValid checks the DPoS consensus level validity of a block
func (*DPoS) IsForkEnable ¶
func (*DPoS) IsTransactionValid ¶
IsTransactionValid checks the DPoS consensus level validity of a transaction
func (*DPoS) MakeConfChangeProposal ¶
func (dpos *DPoS) MakeConfChangeProposal(req *types.MembershipChange) (*consensus.ConfChangePropose, error)
func (*DPoS) NeedNotify ¶
func (*DPoS) QuitChan ¶
func (dpos *DPoS) QuitChan() chan interface{}
QuitChan returns the channel from which consensus-related goroutines check when shutdown is initiated.
func (*DPoS) RaftAccessor ¶
func (dpos *DPoS) RaftAccessor() consensus.AergoRaftAccessor
func (*DPoS) VerifySign ¶
VerifySign reports the validity of the block signature.
type Status ¶
Status manages DPoS-related information like LIB.
func NewStatus ¶
func NewStatus(c bp.ClusterMember, cdb consensus.ChainDB, sdb *state.ChainStateDB, resetHeight types.BlockNo) *Status
NewStatus returns a newly allocated Status.
func (*Status) Info ¶
Info returns the current last irreversible block information as a JSON string.
func (*Status) NeedReorganization ¶
NeedReorganization reports whether reorganization is needed or not.