consensus

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) (*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 data. 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. 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.

Jump to

Keyboard shortcuts

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