xutil

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 6 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 is possible that active-block also is the begin of a 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 CalculateRound

func CalculateRound(blockNumber uint64) uint64

calculate the Consensus number by blockNumber

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 EstimateConsensusRoundsForGov

func EstimateConsensusRoundsForGov(seconds uint64) uint64

func EstimateEndVotingBlockForParaProposal

func EstimateEndVotingBlockForParaProposal(blockNumber uint64, seconds uint64) uint64

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 IsEndOfEpoch

func IsEndOfEpoch(blockNumber uint64) bool

func IsWorker

func IsWorker(extra []byte) bool

func NodeId2Addr

func NodeId2Addr(nodeId discover.NodeID) (common.NodeAddress, 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