consensus

package
v0.5.0-rc4-hotfix2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consensus

type Consensus interface {
	lifecycle.StartStopper

	HandleConsensusMsg(*iotexrpc.Consensus) error
	Calibrate(uint64)
	ValidateBlockFooter(*block.Block) error
	Metrics() (scheme.ConsensusMetrics, error)
}

Consensus is the interface for handling IotxConsensus view change.

func NewConsensus

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

NewConsensus creates a IotxConsensus struct.

type IotxConsensus

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

IotxConsensus implements Consensus

func (*IotxConsensus) Calibrate

func (c *IotxConsensus) Calibrate(height uint64)

Calibrate triggers an event to calibrate consensus context

func (*IotxConsensus) HandleConsensusMsg

func (c *IotxConsensus) HandleConsensusMsg(propose *iotexrpc.Consensus) error

HandleConsensusMsg handles consensus messages

func (*IotxConsensus) Metrics

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

Metrics returns consensus metrics

func (*IotxConsensus) Scheme

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

Scheme returns the scheme instance

func (*IotxConsensus) Start

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

Start starts running the consensus algorithm

func (*IotxConsensus) Stop

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

Stop stops running the consensus algorithm

func (*IotxConsensus) ValidateBlockFooter

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

ValidateBlockFooter validates the signatures in block footer

type Option

type Option func(op *optionParams) error

Option sets Consensus construction parameter.

func WithBroadcast

func WithBroadcast(broadcastHandler scheme.Broadcast) Option

WithBroadcast is an option to add broadcast callback to Consensus

func WithRollDPoSProtocol

func WithRollDPoSProtocol(rp *rp.Protocol) Option

WithRollDPoSProtocol is an option to register rolldpos protocol

func WithRootChainAPI

func WithRootChainAPI(exp explorerapi.Explorer) Option

WithRootChainAPI is an option to add a root chain api to Consensus.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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