rolldpos

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 31 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

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 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) Build added in v0.3.0

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

Build builds a RollDPoS consensus module

func (*Builder) RegisterProtocol added in v0.5.0

func (b *Builder) RegisterProtocol(rp *rolldpos.Protocol) *Builder

RegisterProtocol sets the rolldpos protocol

func (*Builder) SetActPool added in v0.3.0

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

SetActPool sets the action pool APIs

func (*Builder) SetAddr added in v0.3.0

func (b *Builder) SetAddr(encodedAddr string) *Builder

SetAddr sets the address and key pair for signature

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

func (b *Builder) SetBroadcast(broadcastHandler scheme.Broadcast) *Builder

SetBroadcast sets the broadcast callback

func (*Builder) SetCandidatesByHeightFunc added in v0.3.0

func (b *Builder) SetCandidatesByHeightFunc(
	candidatesByHeightFunc CandidatesByHeightFunc,
) *Builder

SetCandidatesByHeightFunc sets candidatesByHeightFunc

func (*Builder) SetClock added in v0.3.0

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

SetClock sets the clock

func (*Builder) SetConfig added in v0.3.0

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

SetConfig sets config

func (*Builder) SetPriKey added in v0.4.4

func (b *Builder) SetPriKey(priKey keypair.PrivateKey) *Builder

SetPriKey sets the private key

func (*Builder) SetRootChainAPI added in v0.4.0

func (b *Builder) SetRootChainAPI(api explorer.Explorer) *Builder

SetRootChainAPI sets root chain API

type CandidatesByHeightFunc added in v0.4.4

type CandidatesByHeightFunc func(uint64) ([]*state.Candidate, error)

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

func (r *RollDPoS) Calibrate(height uint64)

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

func (r *RollDPoS) HandleConsensusMsg(msg *iotexrpc.Consensus) error

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

func (r *RollDPoS) NumPendingEvts() int

NumPendingEvts returns the number of pending events

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

func (*RollDPoS) ValidateBlockFooter added in v0.4.4

func (r *RollDPoS) ValidateBlockFooter(blk *block.Block) error

ValidateBlockFooter validates the signatures in the block footer

Jump to

Keyboard shortcuts

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