Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type ElectMode
- type 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
- type SnailLightChain
Constants ¶
const ( // ElectModeEtrue for etrue ElectModeEtrue = iota // ElectModeFake for Test purpose ElectModeFake )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Election ¶
type Election struct {
// contains filtered or unexported fields
}
func NewElection ¶
func NewElection(fastBlockChain *core.BlockChain, snailBlockChain SnailBlockChain, config Config) *Election
NewElection create election processor and load genesis committee
func NewFakeElection ¶
func NewFakeElection() *Election
NewFakeElection create fake mode election only for testing
func (*Election) FinalizeCommittee ¶
FinalizeCommittee upddate current committee state
func (*Election) GenerateFakeSigns ¶
func (*Election) GetCommittee ¶
func (e *Election) GetCommittee(fastNumber *big.Int) []*types.CommitteeMember
GetCommittee gets committee members propose this fast block
func (*Election) GetCommitteeById ¶
GetCommitteeById return committee info sepecified by Committee ID
func (*Election) GetCurrentCommittee ¶
func (e *Election) GetCurrentCommittee() *committee
func (*Election) GetGenesisCommittee ¶
func (e *Election) GetGenesisCommittee() []*types.CommitteeMember
func (*Election) GetMemberByPubkey ¶
func (e *Election) GetMemberByPubkey(members []*types.CommitteeMember, publickey []byte) *types.CommitteeMember
GetMemberByPubkey returns committeeMember specified by public key bytes
func (*Election) GetMemberFlag ¶
func (e *Election) GetMemberFlag(members []*types.CommitteeMember, publickey []byte) uint32
IsCommitteeMember reports whether the provided public key is in committee
func (*Election) IsCommitteeMember ¶
func (e *Election) IsCommitteeMember(members []*types.CommitteeMember, publickey []byte) bool
func (*Election) SubscribeElectionEvent ¶
func (e *Election) SubscribeElectionEvent(ch chan<- types.ElectionEvent) event.Subscription
SubscribeElectionEvent adds a channel to feed on committee change event
func (*Election) VerifyPublicKey ¶
func (e *Election) VerifyPublicKey(fastHeight *big.Int, pubKeyByte []byte) (*types.CommitteeMember, error)
VerifyPublicKey get the committee member by public key
func (*Election) VerifySign ¶
VerifySign lookup the pbft sign and return the committee member who signs it
func (*Election) VerifySigns ¶
VerifySigns verify signatures of bft committee in batches
func (*Election) VerifySwitchInfo ¶
VerifySwitchInfo verify committee members and it's state
type SnailBlockChain ¶
type SnailBlockChain interface { SnailLightChain // CurrentBlock retrieves the head block from the local chain. CurrentBlock() *types.SnailBlock SubscribeChainEvent(ch chan<- types.SnailChainEvent) event.Subscription GetDatabase() etruedb.Database GetFruitByFastHash(fastHash common.Hash) (*types.SnailBlock, uint64) GetBlockByNumber(number uint64) *types.SnailBlock }
SnailBlockChain encapsulates functions required to sync a (full or fast) blockchain.
type SnailLightChain ¶
type SnailLightChain interface { // CurrentHeader retrieves the head header from the local chain. CurrentHeader() *types.SnailHeader }
SnailLightChain encapsulates functions required to synchronise a light chain.