consensus

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutor

func NewExecutor(abci iabci.AppBlockChain, selector iconsensus.Sortitionor, p *Params) iconsensus.Consensus

NewExecutor return consensus interface and register message handle channel.

Types

type FakeDepositFetcher

type FakeDepositFetcher struct {
}

FakeDepositFetcher just for test.

func (FakeDepositFetcher) GetDepositUnit

func (df FakeDepositFetcher) GetDepositUnit(pk []byte, round int32, index shard.Index) uint32

GetDepositUnit return 1. for test.

type Params

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

Params contains some infos of the miner, such as pk, sk, voteThreshold...

func CreateParams

func CreateParams(pk, sk []byte, voteThreshold int, integrationTest bool, shardIndex shard.Index,
	manager iheartbeat.HeartBeat, pubSubMgr *message.PubSubManager, metrics *metrics.Metrics) *Params

CreateParams will return a pointer to Params, which initialization data is provided by the incoming parameters.

type SimpleBlockInfo

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

SimpleBlockInfo is used for test, (tools, testctl...), it will record cur round block and write them to local file.

func (*SimpleBlockInfo) String

func (sb *SimpleBlockInfo) String() string

type Sortitionor

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

Sortitionor The sortitionor interface is implemented, to determine whether the miner can propose potential block and belong to a shard.

func NewSortitionor

func NewSortitionor(expNumShard uint32, leaderRate uint32) *Sortitionor

NewSortitionor will return a pointer to DummySortitionor.

func (*Sortitionor) IsInShard

func (ds *Sortitionor) IsInShard(proof []byte, depositUnit uint32, index shard.Index) bool

IsInShard return whether the miner belongs to the shard.

func (*Sortitionor) IsLeader

func (ds *Sortitionor) IsLeader(seed []byte, index shard.Index) bool

IsLeader return whether the miner is leader. TODO(#155): Current algorithm is not correct

func (*Sortitionor) SetLeaderRate

func (ds *Sortitionor) SetLeaderRate(n int, index shard.Index)

SetLeaderRate is just for testnet2.0 n is the whole number of miners

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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