Documentation ¶
Index ¶
- Variables
- type Builder
- func (b *Builder) Build() (*RollDPoS, error)
- func (b *Builder) RegisterProtocol(rp *rolldpos.Protocol) *Builder
- func (b *Builder) SetActPool(actPool actpool.ActPool) *Builder
- func (b *Builder) SetAddr(encodedAddr string) *Builder
- func (b *Builder) SetBlockchain(chain blockchain.Blockchain) *Builder
- func (b *Builder) SetBroadcast(broadcastHandler scheme.Broadcast) *Builder
- func (b *Builder) SetCandidatesByHeightFunc(candidatesByHeightFunc CandidatesByHeightFunc) *Builder
- func (b *Builder) SetClock(clock clock.Clock) *Builder
- func (b *Builder) SetConfig(cfg config.Config) *Builder
- func (b *Builder) SetPriKey(priKey keypair.PrivateKey) *Builder
- func (b *Builder) SetRootChainAPI(api explorer.Explorer) *Builder
- type CandidatesByHeightFunc
- type RollDPoS
- func (r *RollDPoS) Calibrate(height uint64)
- func (r *RollDPoS) CurrentState() fsm.State
- func (r *RollDPoS) HandleConsensusMsg(msg *iotexrpc.Consensus) error
- func (r *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)
- func (r *RollDPoS) NumPendingEvts() int
- func (r *RollDPoS) Start(ctx context.Context) error
- func (r *RollDPoS) Stop(ctx context.Context) error
- func (r *RollDPoS) ValidateBlockFooter(blk *block.Block) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNewRollDPoS indicates the error of constructing RollDPoS ErrNewRollDPoS = errors.New("error when constructing RollDPoS") // ErrZeroDelegate indicates seeing 0 delegates in the network ErrZeroDelegate = errors.New("zero delegates in the network") )
var ( // ErrNotEnoughCandidates indicates there are not enough candidates from the candidate pool ErrNotEnoughCandidates = errors.New("Candidate pool does not have enough candidates") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v0.3.0
type Builder struct {
// contains filtered or unexported fields
}
Builder is the builder for RollDPoS
func NewRollDPoSBuilder ¶ added in v0.3.0
func NewRollDPoSBuilder() *Builder
NewRollDPoSBuilder instantiates a Builder instance
func (*Builder) RegisterProtocol ¶ added in v0.5.0
RegisterProtocol sets the rolldpos protocol
func (*Builder) SetActPool ¶ added in v0.3.0
SetActPool sets the action pool APIs
func (*Builder) SetBlockchain ¶ added in v0.3.0
func (b *Builder) SetBlockchain(chain blockchain.Blockchain) *Builder
SetBlockchain sets the blockchain APIs
func (*Builder) SetBroadcast ¶ added in v0.4.4
SetBroadcast sets the broadcast callback
func (*Builder) SetCandidatesByHeightFunc ¶ added in v0.3.0
func (b *Builder) SetCandidatesByHeightFunc( candidatesByHeightFunc CandidatesByHeightFunc, ) *Builder
SetCandidatesByHeightFunc sets candidatesByHeightFunc
type CandidatesByHeightFunc ¶ added in v0.4.4
CandidatesByHeightFunc defines a function to overwrite candidates
type RollDPoS ¶
type RollDPoS struct {
// contains filtered or unexported fields
}
RollDPoS is Roll-DPoS consensus main entrance
func (*RollDPoS) Calibrate ¶ added in v0.4.4
Calibrate called on receive a new block not via consensus
func (*RollDPoS) CurrentState ¶ added in v0.3.0
func (r *RollDPoS) CurrentState() fsm.State
CurrentState returns the current state
func (*RollDPoS) HandleConsensusMsg ¶ added in v0.4.4
HandleConsensusMsg handles incoming consensus message
func (*RollDPoS) Metrics ¶
func (r *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)
Metrics returns RollDPoS consensus metrics
func (*RollDPoS) NumPendingEvts ¶ added in v0.3.0
NumPendingEvts returns the number of pending events