Versions in this module Expand all Collapse all v1 v1.1.3 Feb 13, 2020 Changes in this version + const ElectModeEtrue + const ElectModeFake + var ErrCommittee = errors.New("get committee failed") + var ErrInvalidMember = errors.New("invalid committee member") + var ErrInvalidSwitch = errors.New("invalid switch block info") + type Config interface + GetNodeType func() bool + type ElectMode uint + type Election struct + func NewElection(fastBlockChain *core.BlockChain, snailBlockChain SnailBlockChain, ...) *Election + func NewFakeElection() *Election + func (e *Election) FinalizeCommittee(block *types.Block) error + func (e *Election) GenerateFakeSigns(fb *types.Block) ([]*types.PbftSign, error) + func (e *Election) GetCommittee(fastNumber *big.Int) []*types.CommitteeMember + func (e *Election) GetCommitteeById(id *big.Int) map[string]interface{} + func (e *Election) GetCurrentCommittee() *committee + func (e *Election) GetGenesisCommittee() []*types.CommitteeMember + func (e *Election) GetMemberByPubkey(members []*types.CommitteeMember, publickey []byte) *types.CommitteeMember + func (e *Election) GetMemberFlag(members []*types.CommitteeMember, publickey []byte) uint32 + func (e *Election) IsCommitteeMember(members []*types.CommitteeMember, publickey []byte) bool + func (e *Election) SetEngine(engine consensus.Engine) + func (e *Election) Start() error + func (e *Election) SubscribeElectionEvent(ch chan<- types.ElectionEvent) event.Subscription + func (e *Election) VerifyPublicKey(fastHeight *big.Int, pubKeyByte []byte) (*types.CommitteeMember, error) + func (e *Election) VerifySign(sign *types.PbftSign) (*types.CommitteeMember, error) + func (e *Election) VerifySigns(signs []*types.PbftSign) ([]*types.CommitteeMember, []error) + func (e *Election) VerifySwitchInfo(fastNumber *big.Int, info []*types.CommitteeMember) error + type SnailBlockChain interface + CurrentBlock func() *types.SnailBlock + GetBlockByNumber func(number uint64) *types.SnailBlock + GetDatabase func() etruedb.Database + GetFruitByFastHash func(fastHash common.Hash) (*types.SnailBlock, uint64) + SubscribeChainEvent func(ch chan<- types.SnailChainEvent) event.Subscription + type SnailLightChain interface + CurrentHeader func() *types.SnailHeader