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

package consensus

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

Index

Package Files

consensus.go

type Consensus Uses

type Consensus interface {
    lifecycle.StartStopper

    HandleConsensusMsg(*iotextypes.ConsensusMessage) error
    Calibrate(uint64)
    ValidateBlockFooter(*block.Block) error
    Metrics() (scheme.ConsensusMetrics, error)
    Activate(bool)
    Active() bool
}

Consensus is the interface for handling IotxConsensus view change.

func NewConsensus Uses

func NewConsensus(
    cfg config.Config,
    bc blockchain.Blockchain,
    ap actpool.ActPool,
    opts ...Option,
) (Consensus, error)

NewConsensus creates a IotxConsensus struct.

type IotxConsensus Uses

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

IotxConsensus implements Consensus

func (*IotxConsensus) Activate Uses

func (c *IotxConsensus) Activate(active bool)

Activate activates or pauses the consensus component

func (*IotxConsensus) Active Uses

func (c *IotxConsensus) Active() bool

Active returns true if the consensus component is active or false if it stands by

func (*IotxConsensus) Calibrate Uses

func (c *IotxConsensus) Calibrate(height uint64)

Calibrate triggers an event to calibrate consensus context

func (*IotxConsensus) HandleConsensusMsg Uses

func (c *IotxConsensus) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error

HandleConsensusMsg handles consensus messages

func (*IotxConsensus) Metrics Uses

func (c *IotxConsensus) Metrics() (scheme.ConsensusMetrics, error)

Metrics returns consensus metrics

func (*IotxConsensus) Scheme Uses

func (c *IotxConsensus) Scheme() scheme.Scheme

Scheme returns the scheme instance

func (*IotxConsensus) Start Uses

func (c *IotxConsensus) Start(ctx context.Context) error

Start starts running the consensus algorithm

func (*IotxConsensus) Stop Uses

func (c *IotxConsensus) Stop(ctx context.Context) error

Stop stops running the consensus algorithm

func (*IotxConsensus) ValidateBlockFooter Uses

func (c *IotxConsensus) ValidateBlockFooter(blk *block.Block) error

ValidateBlockFooter validates the signatures in block footer

type Option Uses

type Option func(op *optionParams) error

Option sets Consensus construction parameter.

func WithBroadcast Uses

func WithBroadcast(broadcastHandler scheme.Broadcast) Option

WithBroadcast is an option to add broadcast callback to Consensus

func WithRollDPoSProtocol Uses

func WithRollDPoSProtocol(rp *rp.Protocol) Option

WithRollDPoSProtocol is an option to register rolldpos protocol

Directories

PathSynopsis
consensusfsm
scheme
scheme/rolldpos

Package consensus imports 14 packages (graph) and is imported by 4 packages. Updated 2019-08-25. Refresh now. Tools for package owners.