selection

package
v0.0.0-...-59674b5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMiner = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	// contains filtered or unexported fields
}

[BERITH] Structure that holds the information of the staking accounts for election

func (*Candidate) GetPoint

func (c *Candidate) GetPoint() uint64

type Candidates

type Candidates struct {
	// contains filtered or unexported fields
}

func NewCandidates

func NewCandidates() *Candidates

func (*Candidates) Add

func (cs *Candidates) Add(c Candidate)

[BERITH] Function to register Staker to elect Block Creator The function to be called later is the BlockCreator function.

func (Candidates) GetSeed

func (cs Candidates) GetSeed(config *params.ChainConfig, number uint64) int64

[BERITH] Function to convert block number to hash and force it to int64 Write the result value as Seed.

type JSONCandidate

type JSONCandidate struct {
	Address string `json:"address"`
	Point   uint64 `json:"point"`
	Value   uint64 `json:"value"`
}

type JSONCandidates

type JSONCandidates struct {
	User  []JSONCandidate `json:"user"`
	Total uint64          `json:"total"`
}

func GetCandidates

func GetCandidates(number uint64, hash common.Hash, stks staking.Stakers, state *state.StateDB) *JSONCandidates

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

[BERITH] Circular queue structure for binarySearch by random value

type Range

type Range struct {
	// contains filtered or unexported fields
}

type VoteResult

type VoteResult struct {
	Score *big.Int `json:"score"`
	Rank  int      `json:"rank"`
}

[Berith] Object that stores voting results for election

type VoteResults

type VoteResults map[common.Address]VoteResult

func SelectBlockCreator

func SelectBlockCreator(config *params.ChainConfig, number uint64, hash common.Hash, stks staking.Stakers, state *state.StateDB) VoteResults

[BERITH] Entry function to elect Block Creator Returns the elected Block Creator map.

Jump to

Keyboard shortcuts

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