Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Election ¶
type Election struct {
// contains filtered or unexported fields
}
Election is cached data of election algorithm.
func New ¶
func New( validators *pos.Validators, frameToDecide idx.Frame, forklessCauseFn ForklessCauseFn, getFrameRoots GetFrameRootsFn, ) *Election
New election context
func (*Election) DebugStateHash ¶
DebugStateHash may be used in tests to match election state
func (*Election) ProcessRoot ¶
func (el *Election) ProcessRoot(newRoot RootAndSlot) (*Res, error)
ProcessRoot calculates Atropos votes only for the new root. If this root observes that the current election is decided, then return decided Atropos
func (*Election) Reset ¶
func (el *Election) Reset(validators *pos.Validators, frameToDecide idx.Frame)
Reset erases the current election state, prepare for new election frame
func (*Election) String ¶
func (el *Election) String(voters []RootAndSlot) string
@param (optional) voters is roots to print votes for. May be nil @return election summary in a human readable format
type ForklessCauseFn ¶
ForklessCauseFn returns true if event A is forkless caused by event B
type GetFrameRootsFn ¶
type GetFrameRootsFn func(f idx.Frame) []RootAndSlot
GetFrameRootsFn returns all the roots in the specified frame
type RootAndSlot ¶
RootAndSlot specifies concrete root of slot.