dag

package
v0.0.0-...-26d53d1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name       string
	Revision   int
	StorageDir string

	// size variables
	DatasetInitBytes   uint64 // Bytes in dataset at genesis
	DatasetGrowthBytes uint64 // Dataset growth per epoch
	CacheInitBytes     uint64 // Bytes in cache at genesis
	CacheGrowthBytes   uint64 // Cache growth per epoch

	// lookup tables
	DatasetSizes *LookupTable
	CacheSizes   *LookupTable

	// algorithm variables
	DatasetParents  uint32
	EpochLength     uint64
	SeedEpochLength uint64 // ETC uses a different seed epoch length

	// cache variables
	CacheRounds    int
	CachesCount    int // Maximum number of caches to keep before eviction (only init, don't modify)
	CachesLockMmap bool

	// L1 variables
	L1Enabled       bool
	L1CacheSize     uint64
	L1CacheNumItems uint
}

type DAG

type DAG struct {
	Config
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *DAG

func (*DAG) CacheSize

func (d *DAG) CacheSize(epoch uint64) uint64

func (*DAG) CalcEpoch

func (d *DAG) CalcEpoch(height uint64) uint64

func (*DAG) DatasetSize

func (d *DAG) DatasetSize(epoch uint64) uint64

func (*DAG) GetCache

func (dag *DAG) GetCache(epoch uint64) *cache

func (*DAG) NewLookupFunc1024

func (dag *DAG) NewLookupFunc1024(c *cache, epoch uint64) LookupFunc

func (*DAG) NewLookupFunc2048

func (dag *DAG) NewLookupFunc2048(c *cache, epoch uint64) LookupFunc

func (*DAG) NewLookupFunc512

func (dag *DAG) NewLookupFunc512(c *cache, epoch uint64) LookupFunc

func (*DAG) SeedHash

func (d *DAG) SeedHash(height uint64) []byte

type LookupFunc

type LookupFunc func(index uint32) []uint32

type LookupTable

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

func NewLookupTable

func NewLookupTable(table []uint64, maxEpoch uint64) *LookupTable

Jump to

Keyboard shortcuts

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