Documentation ¶
Index ¶
- type Backend
- type Debug
- type VoteBox
- type VoteManager
- type VotePool
- func (pool *VotePool) FetchVoteByBlockHash(blockHash common.Hash) []*types.VoteEnvelope
- func (pool *VotePool) GetVotes() []*types.VoteEnvelope
- func (pool *VotePool) PutVote(peer string, vote *types.VoteEnvelope)
- func (pool *VotePool) SubscribeNewVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription
- type VoteSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VoteManager ¶
type VoteManager struct {
// contains filtered or unexported fields
}
VoteManager will handle the vote produced by self.
func NewVoteManager ¶
func NewVoteManager( eth Backend, db ethdb.Database, chainconfig *params.ChainConfig, chain *core.BlockChain, pool *VotePool, enableSign bool, blsPasswordPath, blsWalletPath string, engine consensus.FastFinalityPoSA, debug *Debug, ) (*VoteManager, error)
func (*VoteManager) UnderRules ¶
func (voteManager *VoteManager) UnderRules(header *types.Header) bool
UnderRules checks if the produced header under the following rules: A validator must not publish two distinct votes for the same height. (Rule 1) Validators always vote for their canonical chain’s latest block. (Rule 2)
type VotePool ¶
type VotePool struct {
// contains filtered or unexported fields
}
func NewVotePool ¶
func NewVotePool( chain *core.BlockChain, engine consensus.FastFinalityPoSA, maxCurVoteAmountPerBlock int, ) *VotePool
func (*VotePool) FetchVoteByBlockHash ¶
func (pool *VotePool) FetchVoteByBlockHash(blockHash common.Hash) []*types.VoteEnvelope
FetchVoteByBlockHash reads the finality votes for the provided block hash, the concurrent writers may block this function from acquiring the read lock. This function does not sleep and wait for acquiring the lock but keep polling the lock fetchRetry times and returns nil if it still cannot acquire the lock. This mechanism helps to make this function safer because we cannot control the writers and we don't want this function to block the caller.
func (*VotePool) GetVotes ¶
func (pool *VotePool) GetVotes() []*types.VoteEnvelope
GetVotes as batch.
func (*VotePool) SubscribeNewVoteEvent ¶
func (pool *VotePool) SubscribeNewVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription
type VoteSigner ¶
type VoteSigner struct {
// contains filtered or unexported fields
}
func NewVoteSigner ¶
func NewVoteSigner(blsPasswordPath, blsWalletPath string) (*VoteSigner, error)
func (*VoteSigner) SignVote ¶
func (signer *VoteSigner) SignVote(vote *types.VoteEnvelope) error