voter

package
v0.0.0-...-93382e6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package ethapi implements the general Ethereum API functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeedByVotePkr

func GetSeedByVotePkr(wallets []accounts.Wallet, pkr c_type.PKr) *address.Seed

Types

type Backend

type Backend interface {
	AccountManager() *accounts.Manager
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

type Item

type Item struct {
	Key   interface{} //the unique key of item
	Value interface{} //the value of the item
	Block uint64      //the priority of the item in the queue

	//heap.Interface need this index and update them
	Index int //index of the item in the heap
}

type PriorityQueue

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

func (PriorityQueue) GetQueue

func (pq PriorityQueue) GetQueue() []interface{}

func (PriorityQueue) GetQueueItems

func (pq PriorityQueue) GetQueueItems() []*Item

func (*PriorityQueue) Init

func (pq *PriorityQueue) Init(maxSize int)

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (*PriorityQueue) MinItem

func (pq *PriorityQueue) MinItem() *Item

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() *Item

func (*PriorityQueue) PopItem

func (pq *PriorityQueue) PopItem() interface{}

func (*PriorityQueue) PushItem

func (pq *PriorityQueue) PushItem(key, value interface{},
	block uint64) (bPushed bool)

type Voter

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

func NewVoter

func NewVoter(chainconfig *params.ChainConfig, chain blockChain, dece Backend) *Voter

func (*Voter) AddLottery

func (self *Voter) AddLottery(lottery *types.Lottery)

func (*Voter) AddVote

func (self *Voter) AddVote(vote *types.Vote)

func (*Voter) IsLotteryValid

func (self *Voter) IsLotteryValid(lottery *types.Lottery) bool

func (*Voter) SelfShares

func (self *Voter) SelfShares(poshash common.Hash, parent common.Hash, parentNumber *big.Int) ([]voteInfo, error)

func (*Voter) SendLotteryEvent

func (self *Voter) SendLotteryEvent(lottery *types.Lottery)

func (*Voter) SendVoteEvent

func (self *Voter) SendVoteEvent(vote *types.Vote)

func (*Voter) SubscribeNewLotteryEvent

func (self *Voter) SubscribeNewLotteryEvent(ch chan<- core.NewLotteryEvent) event.Subscription

func (*Voter) SubscribeNewVoteEvent

func (self *Voter) SubscribeNewVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription

SubscribeNewTxsEvent registers a subscription of NewTxsEvent and starts sending event to the given channel.

func (*Voter) SubscribeWorkerVoteEvent

func (self *Voter) SubscribeWorkerVoteEvent(ch chan<- core.NewVoteEvent) event.Subscription

Jump to

Keyboard shortcuts

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