Documentation ¶
Index ¶
- Variables
- type Builder
- func (b *Builder) Build() (*RollDPoS, error)
- func (b *Builder) SetActPool(actPool actpool.ActPool) *Builder
- func (b *Builder) SetAddr(addr *iotxaddress.Address) *Builder
- func (b *Builder) SetBlockchain(chain blockchain.Blockchain) *Builder
- func (b *Builder) SetCandidatesByHeightFunc(candidatesByHeightFunc func(uint64) ([]*state.Candidate, error)) *Builder
- func (b *Builder) SetClock(clock clock.Clock) *Builder
- func (b *Builder) SetConfig(cfg config.RollDPoS) *Builder
- func (b *Builder) SetP2P(p2p network.Overlay) *Builder
- func (b *Builder) SetRootChainAPI(api explorerapi.Explorer) *Builder
- type RollDPoS
- func (r *RollDPoS) CurrentState() fsm.State
- func (r *RollDPoS) HandleBlockPropose(propose *iproto.ProposePb) error
- func (r *RollDPoS) HandleEndorse(ePb *iproto.EndorsePb) error
- func (r *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)
- func (r *RollDPoS) NumPendingEvts() int
- func (r *RollDPoS) SetDoneStream(simMsgReady chan bool)
- func (r *RollDPoS) Start(ctx context.Context) error
- func (r *RollDPoS) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEvtCast indicates the error of casting the event ErrEvtCast = errors.New("error when casting the event") // ErrEvtConvert indicates the error of converting the event from/to the proto message ErrEvtConvert = errors.New("error when converting the event from/to the proto message") // ErrEvtType represents an unexpected event type error ErrEvtType = errors.New("error when check the event type") )
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 ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the builder for RollDPoS
func NewRollDPoSBuilder ¶
func NewRollDPoSBuilder() *Builder
NewRollDPoSBuilder instantiates a Builder instance
func (*Builder) SetActPool ¶
SetActPool sets the action pool APIs
func (*Builder) SetAddr ¶
func (b *Builder) SetAddr(addr *iotxaddress.Address) *Builder
SetAddr sets the address and key pair for signature
func (*Builder) SetBlockchain ¶
func (b *Builder) SetBlockchain(chain blockchain.Blockchain) *Builder
SetBlockchain sets the blockchain APIs
func (*Builder) SetCandidatesByHeightFunc ¶
func (b *Builder) SetCandidatesByHeightFunc( candidatesByHeightFunc func(uint64) ([]*state.Candidate, error), ) *Builder
SetCandidatesByHeightFunc sets candidatesByHeightFunc, which is only used by tests
func (*Builder) SetRootChainAPI ¶
func (b *Builder) SetRootChainAPI(api explorerapi.Explorer) *Builder
SetRootChainAPI sets root chain API
type RollDPoS ¶
type RollDPoS struct {
// contains filtered or unexported fields
}
RollDPoS is Roll-DPoS consensus main entrance
func (*RollDPoS) CurrentState ¶
func (r *RollDPoS) CurrentState() fsm.State
CurrentState returns the current state
func (*RollDPoS) HandleBlockPropose ¶
HandleBlockPropose handles incoming block propose
func (*RollDPoS) HandleEndorse ¶
HandleEndorse handles incoming endorse
func (*RollDPoS) Metrics ¶
func (r *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)
Metrics returns RollDPoS consensus metrics
func (*RollDPoS) NumPendingEvts ¶
NumPendingEvts returns the number of pending events
func (*RollDPoS) SetDoneStream ¶
SetDoneStream does nothing for Noop (only used in simulator)