consensus

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddr added in v0.4.0

func GetAddr(cfg *config.Config) *iotxaddress.Address

GetAddr returns the iotex address

Types

type Consensus

type Consensus interface {
	lifecycle.StartStopper

	HandleBlockPropose(*iproto.ProposePb) error
	HandleEndorse(*iproto.EndorsePb) 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,
	p2p network.Overlay,
	opts ...Option,
) Consensus

NewConsensus creates a IotxConsensus struct.

type IotxConsensus added in v0.2.0

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

IotxConsensus implements Consensus

func (*IotxConsensus) HandleBlockPropose added in v0.2.0

func (c *IotxConsensus) HandleBlockPropose(propose *iproto.ProposePb) error

HandleBlockPropose handles a proposed block

func (*IotxConsensus) HandleEndorse added in v0.4.0

func (c *IotxConsensus) HandleEndorse(endorse *iproto.EndorsePb) error

HandleEndorse handle an endorse

func (*IotxConsensus) Metrics added in v0.2.0

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

Metrics returns consensus metrics

func (*IotxConsensus) Scheme added in v0.2.0

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

Scheme returns the scheme instance

func (*IotxConsensus) Start added in v0.2.0

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

Start starts running the consensus algorithm

func (*IotxConsensus) Stop added in v0.2.0

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

Stop stops running the consensus algorithm

type Option added in v0.4.0

type Option func(op *optionParams) error

Option sets Consensus construction parameter.

func WithRootChainAPI added in v0.4.0

func WithRootChainAPI(exp explorerapi.Explorer) Option

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

Directories

Path Synopsis
sim

Jump to

Keyboard shortcuts

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