rolldpos

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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")
)
View Source
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) Build

func (b *Builder) Build() (*RollDPoS, error)

Build builds a RollDPoS consensus module

func (*Builder) SetActPool

func (b *Builder) SetActPool(actPool actpool.ActPool) *Builder

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) SetClock

func (b *Builder) SetClock(clock clock.Clock) *Builder

SetClock sets the clock

func (*Builder) SetConfig

func (b *Builder) SetConfig(cfg config.RollDPoS) *Builder

SetConfig sets RollDPoS config

func (*Builder) SetP2P

func (b *Builder) SetP2P(p2p network.Overlay) *Builder

SetP2P sets the P2P APIs

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

func (r *RollDPoS) HandleBlockPropose(propose *iproto.ProposePb) error

HandleBlockPropose handles incoming block propose

func (*RollDPoS) HandleEndorse

func (r *RollDPoS) HandleEndorse(ePb *iproto.EndorsePb) error

HandleEndorse handles incoming endorse

func (*RollDPoS) Metrics

func (r *RollDPoS) Metrics() (scheme.ConsensusMetrics, error)

Metrics returns RollDPoS consensus metrics

func (*RollDPoS) NumPendingEvts

func (r *RollDPoS) NumPendingEvts() int

NumPendingEvts returns the number of pending events

func (*RollDPoS) SetDoneStream

func (r *RollDPoS) SetDoneStream(simMsgReady chan bool)

SetDoneStream does nothing for Noop (only used in simulator)

func (*RollDPoS) Start

func (r *RollDPoS) Start(ctx context.Context) error

Start starts RollDPoS consensus

func (*RollDPoS) Stop

func (r *RollDPoS) Stop(ctx context.Context) error

Stop stops RollDPoS consensus

Jump to

Keyboard shortcuts

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