iotex-core: github.com/iotexproject/iotex-core/consensus/scheme/rolldpos Index | Files

package rolldpos

import "github.com/iotexproject/iotex-core/consensus/scheme/rolldpos"

Index

Package Files

blockproposal.go consensusvote.go endorsedconsensusmessage.go endorsementmanager.go rolldpos.go rolldposctx.go roundcalculator.go roundctx.go subchain.go

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")
    // ErrNotEnoughCandidates indicates there are not enough candidates from the candidate pool
    ErrNotEnoughCandidates = errors.New("Candidate pool does not have enough candidates")
)
var (
    // ErrExpiredEndorsement indicates that the endorsement is expired
    ErrExpiredEndorsement = errors.New("the endorsement has been replaced or expired")
)
var ErrInsufficientEndorsements = errors.New("Insufficient endorsements")

ErrInsufficientEndorsements represents the error that not enough endorsements

type Builder Uses

type Builder struct {
    // contains filtered or unexported fields
}

Builder is the builder for RollDPoS

func NewRollDPoSBuilder Uses

func NewRollDPoSBuilder() *Builder

NewRollDPoSBuilder instantiates a Builder instance

func (*Builder) Build Uses

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

Build builds a RollDPoS consensus module

func (*Builder) RegisterProtocol Uses

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

RegisterProtocol sets the rolldpos protocol

func (*Builder) SetActPool Uses

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

SetActPool sets the action pool APIs

func (*Builder) SetAddr Uses

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

SetAddr sets the address and key pair for signature

func (*Builder) SetBlockchain Uses

func (b *Builder) SetBlockchain(chain blockchain.Blockchain) *Builder

SetBlockchain sets the blockchain APIs

func (*Builder) SetBroadcast Uses

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

SetBroadcast sets the broadcast callback

func (*Builder) SetCandidatesByHeightFunc Uses

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

SetCandidatesByHeightFunc sets candidatesByHeightFunc

func (*Builder) SetClock Uses

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

SetClock sets the clock

func (*Builder) SetConfig Uses

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

SetConfig sets config

func (*Builder) SetPriKey Uses

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

SetPriKey sets the private key

type CandidatesByHeightFunc Uses

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

CandidatesByHeightFunc defines a function to overwrite candidates

type ConsensusVote Uses

type ConsensusVote struct {
    // contains filtered or unexported fields
}

ConsensusVote is a vote on a given topic for a block on a specific height

func NewConsensusVote Uses

func NewConsensusVote(
    blkHash []byte,
    topic ConsensusVoteTopic,
) *ConsensusVote

NewConsensusVote creates a consensus vote

func (*ConsensusVote) BlockHash Uses

func (v *ConsensusVote) BlockHash() []byte

BlockHash returns the block hash of the consensus vote

func (*ConsensusVote) Hash Uses

func (v *ConsensusVote) Hash() ([]byte, error)

Hash returns the hash of this vote

func (*ConsensusVote) LoadProto Uses

func (v *ConsensusVote) LoadProto(msg *iotextypes.ConsensusVote) error

LoadProto loads from a protobuf message

func (*ConsensusVote) Proto Uses

func (v *ConsensusVote) Proto() (*iotextypes.ConsensusVote, error)

Proto converts to a protobuf message

func (*ConsensusVote) Topic Uses

func (v *ConsensusVote) Topic() ConsensusVoteTopic

Topic returns the topic of the consensus vote

type ConsensusVoteTopic Uses

type ConsensusVoteTopic uint8

ConsensusVoteTopic defines the topic of an consensus vote

const (
    // PROPOSAL stands for an consensus vote to endorse a block proposal
    PROPOSAL ConsensusVoteTopic = 0
    // LOCK stands for an consensus vote to endorse a lock on a proposed block
    LOCK ConsensusVoteTopic = 1
    // COMMIT stands for an consensus vote to endorse a block commit
    COMMIT ConsensusVoteTopic = 2
)

type EndorsedConsensusMessage Uses

type EndorsedConsensusMessage struct {
    // contains filtered or unexported fields
}

EndorsedConsensusMessage is an endorsement on document

func NewEndorsedConsensusMessage Uses

func NewEndorsedConsensusMessage(
    height uint64,
    message endorsement.Document,
    endorsement *endorsement.Endorsement,
) *EndorsedConsensusMessage

NewEndorsedConsensusMessage creates an EndorsedConsensusMessage for an consensus vote

func (*EndorsedConsensusMessage) Document Uses

func (ecm *EndorsedConsensusMessage) Document() endorsement.Document

Document returns the endorsed consensus message

func (*EndorsedConsensusMessage) Endorsement Uses

func (ecm *EndorsedConsensusMessage) Endorsement() *endorsement.Endorsement

Endorsement returns the endorsement

func (*EndorsedConsensusMessage) Height Uses

func (ecm *EndorsedConsensusMessage) Height() uint64

Height returns the height of this message

func (*EndorsedConsensusMessage) LoadProto Uses

func (ecm *EndorsedConsensusMessage) LoadProto(msg *iotextypes.ConsensusMessage) error

LoadProto creates an endorsement message from protobuf message

func (*EndorsedConsensusMessage) Proto Uses

func (ecm *EndorsedConsensusMessage) Proto() (*iotextypes.ConsensusMessage, error)

Proto converts an endorsement to endorse proto

type RollDPoS Uses

type RollDPoS struct {
    // contains filtered or unexported fields
}

RollDPoS is Roll-DPoS consensus main entrance

func (*RollDPoS) Activate Uses

func (r *RollDPoS) Activate(active bool)

Activate activates or pauses the roll-DPoS consensus. When it is deactivated, the node will finish the current consensus round if it is doing the work and then return the the initial state

func (*RollDPoS) Active Uses

func (r *RollDPoS) Active() bool

Active is true if the roll-DPoS consensus is active, or false if it is stand-by

func (*RollDPoS) Calibrate Uses

func (r *RollDPoS) Calibrate(height uint64)

Calibrate called on receive a new block not via consensus

func (*RollDPoS) CurrentState Uses

func (r *RollDPoS) CurrentState() fsm.State

CurrentState returns the current state

func (*RollDPoS) HandleConsensusMsg Uses

func (r *RollDPoS) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error

HandleConsensusMsg handles incoming consensus message

func (*RollDPoS) Metrics Uses

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

Metrics returns RollDPoS consensus metrics

func (*RollDPoS) NumPendingEvts Uses

func (r *RollDPoS) NumPendingEvts() int

NumPendingEvts returns the number of pending events

func (*RollDPoS) Start Uses

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

Start starts RollDPoS consensus

func (*RollDPoS) Stop Uses

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

Stop stops RollDPoS consensus

func (*RollDPoS) ValidateBlockFooter Uses

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

ValidateBlockFooter validates the signatures in the block footer

Package rolldpos imports 27 packages (graph) and is imported by 2 packages. Updated 2019-08-02. Refresh now. Tools for package owners.