Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidates ¶
type Candidates struct {
// contains filtered or unexported fields
}
Candidates holds candidates list in memory, and tends to be reused in PoAL stage without querying from contract.
func NewCandidates ¶
func NewCandidates(list []*authority.Candidate) *Candidates
NewCandidates creates candidates list.
func (*Candidates) InvalidateCache ¶
func (c *Candidates) InvalidateCache()
InvalidateCache invalidate the result cache of Pick method.
func (*Candidates) IsEndorsor ¶
func (c *Candidates) IsEndorsor(addr luckyshare.Address) bool
IsEndorsor returns whether an address is an endorsor.
func (*Candidates) Pick ¶
func (c *Candidates) Pick(state *state.State) ([]Proposer, error)
Pick picks a list of proposers, which satisfy preset conditions.
func (*Candidates) Update ¶
func (c *Candidates) Update(addr luckyshare.Address, active bool) bool
Update update candidate activity status, by its master address. It returns false if the given address is not a master.
type Proposer ¶
type Proposer struct { Address luckyshare.Address Active bool }
Proposer address with status.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler to schedule the time when a proposer to produce a block.
func NewScheduler ¶
func NewScheduler( addr luckyshare.Address, proposers []Proposer, parentBlockNumber uint32, parentBlockTime uint64) (*Scheduler, error)
NewScheduler create a Scheduler object. `addr` is the proposer to be scheduled. If `addr` is not listed in `proposers`, an error returned.