consensus

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Protocols added in v0.13.0

func Protocols() []protocol.ID

Protocols returns the supported protocols of this package in order of precedence.

Types

type Component

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

Component implements core.Consensus.

func New added in v0.5.0

func New(tcpNode host.Host, sender *p2p.Sender, peers []p2p.Peer, p2pKey *ecdsa.PrivateKey,
	deadliner core.Deadliner, snifferFunc func(*pbv1.SniffedConsensusInstance),
) (*Component, error)

New returns a new consensus QBFT component.

func (*Component) Propose

func (c *Component) Propose(ctx context.Context, duty core.Duty, data core.UnsignedDataSet) error

Propose participants in a consensus instance proposing the provided unsigned data set. It returns on error or nil when the context is cancelled.

func (*Component) ProposePriority added in v0.11.0

func (c *Component) ProposePriority(ctx context.Context, duty core.Duty, msg *pbv1.PriorityResult) error

ProposePriority participants in a consensus instance proposing the provided priority message. It returns on error or nil when the context is cancelled.

func (*Component) Start

func (c *Component) Start(ctx context.Context)

Start registers the libp2p receive handler and starts a goroutine that cleans state. This should only be called once.

func (*Component) Subscribe

func (c *Component) Subscribe(fn func(ctx context.Context, duty core.Duty, set core.UnsignedDataSet) error)

Subscribe registers a callback for unsigned duty data proposals from leaders. Note this function is not thread safe, it should be called *before* Start and Propose.

func (*Component) SubscribePriority added in v0.11.0

func (c *Component) SubscribePriority(fn func(ctx context.Context, duty core.Duty, msg *pbv1.PriorityResult) error)

SubscribePriority registers a callback for priority protocol message proposals from leaders. Note this function is not thread safe, it should be called *before* Start and Propose.

Jump to

Keyboard shortcuts

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