leaderelection

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmValidator

func AmValidator(state types2.AnchorState) (amValidator bool, err error)

AmValidator : determines if this node is a validator, without needing to load an ID from elsewhere

func ElectChainContributorAsLeader

func ElectChainContributorAsLeader(numLeaders int, blacklistedIDs []string, state types2.AnchorState) (isLeader bool, leaderID []string)

ElectChainContributedAsLeader : elects a node that's contributed to the chain while checking if it's submitted a NIST value recently

func ElectChainContributorAsLeaderNaive

func ElectChainContributorAsLeaderNaive(numLeaders int, blacklistedIDs []string, state types2.AnchorState) (isLeader bool, leaderID []string)

ElectChainContributedAsLeaderNaive : elects a node that's contributed to the chain without checking if its been active recently

func ElectPeerAsLeader

func ElectPeerAsLeader(numLeaders int, blacklistedIDs []string, state types2.AnchorState) (isLeader bool, leaderID []string)

ElectPeerAsLeader deterministically elects a network leader by creating an array of peers and using a blockhash-seeded random int as an index

func ElectValidatorAsLeader

func ElectValidatorAsLeader(numLeaders int, blacklistedIDs []string, state types2.AnchorState, config types2.AnchorConfig) (isLeader bool, leaderID []string)

ElectValidatorAsLeader : elect a slice of validators as a leader and return whether we're the leader

func GetPeers

func GetPeers(state types2.AnchorState, tmState core_types.ResultStatus, tmNetInfo core_types.ResultNetInfo) []core_types.Peer

GetPeers : get list of all peers

func GetSortedPeerList

func GetSortedPeerList(status core_types.ResultStatus, netInfo core_types.ResultNetInfo) []core_types.Peer

GetSortedPeerList : returns sorted list of peers including self

func GetSortedValidatorList

func GetSortedValidatorList(validators []*types.Validator) []types.Validator

GetSortedValidatorList : collate and deterministically sort validator list

func IsValidator

func IsValidator(state types2.AnchorState, ID string) (amValidator bool, err error)

IsValidator : determines if a node is a validator by checking an external ID

Types

This section is empty.

Jump to

Keyboard shortcuts

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