epoch

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GenesisTime is the time (Unix in seconds) of the genesis.
	GenesisTime int64 = 1656588336
	// Duration is the default epoch duration in seconds.
	Duration int64 = 10
)

Functions

This section is empty.

Types

type EC

type EC = MerkleRoot

type ECR

type ECR = MerkleRoot

type ECRecord

type ECRecord struct {
	model.Storable[Index, ECRecord, *ECRecord, ecRecord] `serix:"0"`
}

ECRecord is a storable object represents the ecRecord of an epoch.

func NewECRecord

func NewECRecord(ei Index) (new *ECRecord)

NewECRecord creates and returns a ECRecord of the given EI.

func (*ECRecord) ECR

func (e *ECRecord) ECR() ECR

ECR returns the ECR of an ECRecord.

func (*ECRecord) EI

func (e *ECRecord) EI() Index

func (*ECRecord) PrevEC

func (e *ECRecord) PrevEC() EC

PrevEC returns the EC of an ECRecord.

func (*ECRecord) SetECR

func (e *ECRecord) SetECR(ecr ECR)

SetECR sets the ECR of an ECRecord.

func (*ECRecord) SetEI

func (e *ECRecord) SetEI(ei Index)

func (*ECRecord) SetPrevEC

func (e *ECRecord) SetPrevEC(prevEC EC)

SetPrevEC sets the PrevEC of an ECRecord.

type Index

type Index int64

Index is the ID of an epoch.

func CurrentEpochIndex

func CurrentEpochIndex() Index

CurrentEpochIndex returns the EI at the current RATT time.

func IndexFromBytes

func IndexFromBytes(bytes []byte) (ei Index, consumedBytes int, err error)

func IndexFromTime

func IndexFromTime(t time.Time) Index

IndexFromTime calculates the EI for the given time.

func (Index) Bytes

func (i Index) Bytes() []byte

func (Index) EndTime

func (i Index) EndTime() time.Time

EndTime calculates the end time of the given epoch.

func (Index) StartTime

func (i Index) StartTime() time.Time

StartTime calculates the start time of the given epoch.

func (Index) String

func (i Index) String() string

type MerkleRoot

type MerkleRoot [blake2b.Size256]byte

func NewMerkleRoot

func NewMerkleRoot(bytes []byte) (mr MerkleRoot)

func (MerkleRoot) Base58

func (m MerkleRoot) Base58() string

func (MerkleRoot) Bytes

func (m MerkleRoot) Bytes() []byte

Jump to

Keyboard shortcuts

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