consensus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLeaf

func CreateLeaf(parent *data.Block, cmds []data.Command, qc *data.QuorumCert, height int) *data.Block

CreateLeaf returns a new block that extends the parent.

Types

type Event

type Event struct {
	Type    EventType
	QC      *data.QuorumCert
	Block   *data.Block
	Replica config.ReplicaID
}

Event is sent to the pacemaker to allow it to observe the protocol.

type EventType

type EventType uint8

EventType is the type of notification sent to pacemaker

const (
	QCFinish EventType = iota
	ReceiveProposal
	ReceiveVote
	HQCUpdate
	ReceiveNewView
)

These are the types of events that can be sent to pacemaker

type HotStuffCore

type HotStuffCore struct {
	Config   *config.ReplicaConfig
	Blocks   data.BlockStorage
	SigCache *data.SignatureCache
	// contains filtered or unexported fields
}

HotStuffCore is the safety core of the HotStuffCore protocol

func New

func New(conf *config.ReplicaConfig) *HotStuffCore

New creates a new Hotstuff instance

func (*HotStuffCore) AddCommand

func (hs *HotStuffCore) AddCommand(command data.Command)

func (*HotStuffCore) Close

func (hs *HotStuffCore) Close()

Close frees resources held by HotStuff and closes backend connections

func (*HotStuffCore) CreateProposal

func (hs *HotStuffCore) CreateProposal() *data.Block

CreateProposal creates a new proposal

func (*HotStuffCore) GetEvents

func (hs *HotStuffCore) GetEvents() chan Event

func (*HotStuffCore) GetExec

func (hs *HotStuffCore) GetExec() chan []data.Command

func (*HotStuffCore) GetHeight

func (hs *HotStuffCore) GetHeight() int

GetHeight returns the height of the tree

func (*HotStuffCore) GetLeaf

func (hs *HotStuffCore) GetLeaf() *data.Block

GetLeaf returns the current leaf node of the tree

func (*HotStuffCore) GetQCHigh

func (hs *HotStuffCore) GetQCHigh() *data.QuorumCert

GetQCHigh returns the highest valid Quorum Certificate known to the hotstuff instance.

func (*HotStuffCore) GetVotedHeight

func (hs *HotStuffCore) GetVotedHeight() int

GetVotedHeight returns the height that was last voted at

func (*HotStuffCore) OnReceiveNewView

func (hs *HotStuffCore) OnReceiveNewView(qc *data.QuorumCert)

OnReceiveNewView handles the leader's response to receiving a NewView rpc from a replica

func (*HotStuffCore) OnReceiveProposal

func (hs *HotStuffCore) OnReceiveProposal(block *data.Block) (*data.PartialCert, error)

OnReceiveProposal handles a replica's response to the Proposal from the leader

func (*HotStuffCore) OnReceiveVote

func (hs *HotStuffCore) OnReceiveVote(cert *data.PartialCert)

OnReceiveVote handles an incoming vote from a replica

func (*HotStuffCore) SetLeaf

func (hs *HotStuffCore) SetLeaf(block *data.Block)

SetLeaf sets the leaf node of the tree

func (*HotStuffCore) UpdateQCHigh

func (hs *HotStuffCore) UpdateQCHigh(qc *data.QuorumCert) bool

UpdateQCHigh updates the qc held by the paceMaker, to the newest qc.

Jump to

Keyboard shortcuts

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