consensus

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: GPL-3.0 Imports: 20 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 NewComponent

func NewComponent(tcpNode host.Host, peers []p2p.Peer,
	peerIdx int64, p2pKey *ecdsa.PrivateKey,
) (*Component, error)

NewComponent 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 when the context is cancelled.

func (*Component) Start

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

Start registers the libp2p receive handler.

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