Documentation
¶
Index ¶
- func Protocols() []protocol.ID
- type Component
- func (c *Component) Propose(ctx context.Context, duty core.Duty, data core.UnsignedDataSet) error
- func (c *Component) ProposePriority(ctx context.Context, duty core.Duty, msg *pbv1.PriorityResult) error
- func (c *Component) Start(ctx context.Context)
- func (c *Component) Subscribe(fn func(ctx context.Context, duty core.Duty, set core.UnsignedDataSet) error)
- func (c *Component) SubscribePriority(fn func(ctx context.Context, duty core.Duty, msg *pbv1.PriorityResult) error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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.