voter

package
v1.0.0-rc2-review Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: GPL-3.0 Imports: 17 Imported by: 1

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 keys.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 ItemSlice

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

func (ItemSlice) Len

func (s ItemSlice) Len() int

func (ItemSlice) Less

func (s ItemSlice) Less(i, j int) bool

func (*ItemSlice) Pop

func (s *ItemSlice) Pop() interface{}

func (*ItemSlice) Push

func (s *ItemSlice) Push(x interface{})

func (ItemSlice) Swap

func (s ItemSlice) Swap(i, j int)

func (*ItemSlice) Update

func (s *ItemSlice) Update(key interface{}, value interface{}, block uint64)

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, sero 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