vote

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	IsMining() bool
	EventMux() *event.TypeMux
}

Backend wraps all methods required for voting.

type VoteBox

type VoteBox struct {
	// contains filtered or unexported fields
}

type VoteJournal

type VoteJournal struct {
	// contains filtered or unexported fields
}

func NewVoteJournal

func NewVoteJournal(filePath string) (*VoteJournal, error)

func (*VoteJournal) ReadVote

func (journal *VoteJournal) ReadVote(index uint64) (*types.VoteEnvelope, error)

func (*VoteJournal) WriteVote

func (journal *VoteJournal) WriteVote(voteMessage *types.VoteEnvelope) error

type VoteManager

type VoteManager struct {
	// contains filtered or unexported fields
}

VoteManager will handle the vote produced by self.

func NewVoteManager

func NewVoteManager(eth Backend, chain *core.BlockChain, pool *VotePool, journalPath, blsPasswordPath, blsWalletPath string, engine consensus.PoSA) (*VoteManager, error)

func (*VoteManager) UnderRules

func (voteManager *VoteManager) UnderRules(header *types.Header) (bool, uint64, common.Hash)

UnderRules checks if the produced header under the following rules: A validator must not publish two distinct votes for the same height. (Rule 1) A validator must not vote within the span of its other votes . (Rule 2) Validators always vote for their canonical chain’s latest block. (Rule 3)

type VotePool

type VotePool struct {
	// contains filtered or unexported fields
}

func NewVotePool

func NewVotePool(chain *core.BlockChain, engine consensus.PoSA) *VotePool

func (*VotePool) FetchVoteByBlockHash

func (pool *VotePool) FetchVoteByBlockHash(blockHash common.Hash) []*types.VoteEnvelope

func (*VotePool) GetVotes

func (pool *VotePool) GetVotes() []*types.VoteEnvelope

GetVotes as batch.

func (*VotePool) PutVote

func (pool *VotePool) PutVote(vote *types.VoteEnvelope)

func (*VotePool) SubscribeNewVoteEvent

func (pool *VotePool) SubscribeNewVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription

type VoteSigner

type VoteSigner struct {
	PubKey [48]byte
	// 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL