utils

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToHex

func BytesToHex(a []byte) string

func CalcDecentralCoefficient added in v0.0.11

func CalcDecentralCoefficient(smeshers map[string]int64) int64

CalcDecentralCoefficient calc decentral coefficient for epoch stat.

func CalcEpochCapacity added in v0.0.11

func CalcEpochCapacity(transactionsNum int64, epochDuration float64, maxTransactionPerSecond uint32) int64

CalcEpochCapacity calc capacity for epoch stat.

func CalculateLayerStartEndDate added in v0.0.11

func CalculateLayerStartEndDate(genesisTime, layerNum, layerDuration uint32) (layerStartDate, layerEndDate uint32)

CalculateLayerStartEndDate ...

func FindStringValue

func FindStringValue(obj *bson.D, key string) string

func GetAsBool

func GetAsBool(rv bson.RawValue) bool

func GetAsInt

func GetAsInt(rv bson.RawValue) int

func GetAsInt32

func GetAsInt32(rv bson.RawValue) int32

func GetAsInt64

func GetAsInt64(rv bson.RawValue) int64

func GetAsString

func GetAsString(rv bson.RawValue) string

func GetAsUInt32

func GetAsUInt32(rv bson.RawValue) uint32

func GetAsUInt64

func GetAsUInt64(rv bson.RawValue) uint64

func Gini

func Gini(smeshers map[string]int64) float64
1          sum((n + 1 - i)*y[i])

G = -(n + 1 - 2---------------------

n                sum(y[i])

func NBytesToHex

func NBytesToHex(a []byte, n int) string

func PrintActivation

func PrintActivation(atx *pb.Activation)

func PrintBlock

func PrintBlock(block *pb.Block)

func PrintLayer

func PrintLayer(layer *pb.Layer)

func PrintReward

func PrintReward(reward *pb.Reward)

func PrintTransaction

func PrintTransaction(tx *pb.Transaction)

func StringToBytes

func StringToBytes(s string) ([]byte, error)

Types

type CommitmentSizes

type CommitmentSizes []int64

func (CommitmentSizes) Len

func (a CommitmentSizes) Len() int

func (CommitmentSizes) Less

func (a CommitmentSizes) Less(i, j int) bool

func (CommitmentSizes) Swap

func (a CommitmentSizes) Swap(i, j int)

Jump to

Keyboard shortcuts

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