Versions in this module Expand all Collapse all v0 v0.1.0 Apr 21, 2023 Changes in this version + var ErrAlreadyCandidate = errors.New("already a candidate") + var ErrAlreadyVoted = errors.New("already voted for this address") + var ErrCandidateIsValidator = errors.New("the candidate is already a validator") + var ErrCandidateNotExistInSet = errors.New("cannot remove a validator if they're not in the snapshot") + var ErrIncorrectNonce = errors.New("incorrect vote nonce") + var ErrInvalidNonce = errors.New("invalid nonce specified") + var ErrMultipleVotesBySameValidator = errors.New("more than one proposal per validator per address found") + var ErrSnapshotNotFound = errors.New("not found snapshot") + var ErrUnauthorizedProposer = errors.New("unauthorized proposer") + type SignerInterface interface + EcrecoverFromHeader func(*types.Header) (types.Address, error) + GetValidators func(*types.Header) (validators.Validators, error) + Type func() validators.ValidatorType + type Snapshot struct + Hash string + Number uint64 + Set validators.Validators + Votes []*store.Vote + func (s *Snapshot) AddVote(voter types.Address, candidate validators.Validator, authorize bool) + func (s *Snapshot) Copy() *Snapshot + func (s *Snapshot) Count(h func(v *store.Vote) bool) (count int) + func (s *Snapshot) CountByCandidate(candidate validators.Validator) int + func (s *Snapshot) CountByVoterAndCandidate(voter types.Address, candidate validators.Validator) int + func (s *Snapshot) Equal(ss *Snapshot) bool + func (s *Snapshot) MarshalJSON() ([]byte, error) + func (s *Snapshot) RemoveVotes(shouldRemoveFn func(v *store.Vote) bool) + func (s *Snapshot) RemoveVotesByCandidate(candidate validators.Validator) + func (s *Snapshot) RemoveVotesByVoter(address types.Address) + func (s *Snapshot) UnmarshalJSON(data []byte) error + type SnapshotMetadata struct + LastBlock uint64 + type SnapshotValidatorStore struct + func NewSnapshotValidatorStore(logger hclog.Logger, blockchain store.HeaderGetter, ...) (*SnapshotValidatorStore, error) + func (s *SnapshotValidatorStore) Candidates() []*store.Candidate + func (s *SnapshotValidatorStore) GetSnapshotMetadata() *SnapshotMetadata + func (s *SnapshotValidatorStore) GetSnapshots() []*Snapshot + func (s *SnapshotValidatorStore) GetValidatorsByHeight(height uint64) (validators.Validators, error) + func (s *SnapshotValidatorStore) ModifyHeader(header *types.Header, proposer types.Address) error + func (s *SnapshotValidatorStore) ProcessHeader(header *types.Header) error + func (s *SnapshotValidatorStore) ProcessHeadersInRange(from, to uint64) error + func (s *SnapshotValidatorStore) Propose(candidate validators.Validator, auth bool, proposer types.Address) error + func (s *SnapshotValidatorStore) SourceType() store.SourceType + func (s *SnapshotValidatorStore) UpdateValidatorSet(newValidators validators.Validators, fromHeight uint64) error + func (s *SnapshotValidatorStore) VerifyHeader(header *types.Header) error + func (s *SnapshotValidatorStore) Votes(height uint64) ([]*store.Vote, error)