consensus

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FCOB

type FCOB struct {
	Events *FCOBEvents
	// contains filtered or unexported fields
}

FCOB defines the "Fast Consensus of Barcelona" rules that are used to form the initial opinions of nodes. It uses a local modifier based approach to reach approximate consensus within the network by waiting 1 network delay before setting a transaction to preferred (if it didnt see a conflict) and another network delay to set it to finalized (if it still didn't see a conflict).

func NewFCOB

func NewFCOB(tangle *tangle.Tangle, averageNetworkDelay time.Duration) (fcob *FCOB)

NewFCOB is the constructor for an FCOB consensus instance. It automatically attaches to the passed in Tangle and calls the corresponding Events if it needs to trigger a vote.

func (*FCOB) ProcessVoteResult

func (fcob *FCOB) ProcessVoteResult(ev *vote.OpinionEvent)

ProcessVoteResult allows an external voter to hand in the results of the voting process.

type FCOBEvents

type FCOBEvents struct {
	// Error gets called when FCOB faces an error.
	Error *events.Event

	// Vote gets called when FCOB needs to vote on a transaction.
	Vote *events.Event
}

FCOBEvents acts as a dictionary for events of an FCOB instance.

Jump to

Keyboard shortcuts

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