xutil

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalActiveBlock

func CalActiveBlock(endVotingBlock uint64) uint64

active-block = the begin of a consensus period, so, It's possible that active-block is the begin block of a settlement epoch

func CalEndVotingBlock

func CalEndVotingBlock(blockNumber uint64, endVotingRounds uint64) uint64

end-voting-block = the end block of a consensus period - electionDistance, end-voting-block must be a Consensus Election block

func CalcBlocksEachEpoch

func CalcBlocksEachEpoch() uint64

CalcBlocksEachEpoch return how many blocks per epoch

func CalcBlocksEachYear

func CalcBlocksEachYear() uint64

calculate returns how many blocks per year.

func CalcVersion

func CalcVersion(programVersion uint32) uint32

The ProgramVersion: Major.Minor.Patch eg. 1.1.0 Calculate the LargeVersion eg: 1.1.x ==> 1.1.0

func CalculateEpoch

func CalculateEpoch(blockNumber uint64) uint64

calculate the Epoch number by blockNumber

func CalculateLastYear

func CalculateLastYear(blockNumber uint64) uint32

func CalculateRound

func CalculateRound(blockNumber uint64) uint64

calculate the Consensus number by blockNumber

func CalculateYear

func CalculateYear(blockNumber uint64) uint32

calculate the year by blockNumber. (V.0.1) If blockNumber eqs 0, year eqs 0 too, else rounded up the result of the blockNumber divided by the expected number of blocks per year

func CheckMinimumThreshold

func CheckMinimumThreshold(balance *big.Int) bool

func CheckStakeThreshold

func CheckStakeThreshold(stake *big.Int) bool

func ConsensusSize

func ConsensusSize() uint64

ConsensusSize returns how many blocks per consensus round.

func EpochSize

func EpochSize() uint64

EpochSize returns how many consensus rounds per epoch.

func EpochsPerYear

func EpochsPerYear() uint64

EpochsPerYear returns how many epochs per year

func InHashList

func InHashList(hash common.Hash, hashList []common.Hash) bool

func InNodeIDList

func InNodeIDList(nodeID discover.NodeID, nodeIDList []discover.NodeID) bool

func IsBeginOfConsensus

func IsBeginOfConsensus(blockNumber uint64) bool

IsBeginOfConsensus returns true if current block is the first block of a Consensus Cycle

func IsBeginOfEpoch

func IsBeginOfEpoch(blockNumber uint64) bool

IsBeginOfEpoch returns true if current block is the first block of a Epoch

func IsElection

func IsElection(blockNumber uint64) bool

func IsEndOfConsensus

func IsEndOfConsensus(blockNumber uint64) bool

func IsEndOfEpoch

func IsEndOfEpoch(blockNumber uint64) bool

func IsSpecialBlock

func IsSpecialBlock(blockNumber uint64) bool

func IsWorker

func IsWorker(extra []byte) bool

func IsYearBegin

func IsYearBegin(blockNumber uint64) bool

func IsYearEnd

func IsYearEnd(blockNumber uint64) bool

func NodeId2Addr

func NodeId2Addr(nodeId discover.NodeID) (common.Address, error)

func ProgramVersion2Str

func ProgramVersion2Str(programVersion uint32) string

eg. 65536 => 1.0.0

Types

This section is empty.

Jump to

Keyboard shortcuts

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