ethashproof

package
v0.0.0-...-4c59aa4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CACHE_LEVEL uint64 = 15

Variables

This section is empty.

Functions

func CacheFilePath

func CacheFilePath(dirPath string, epoch uint64) string

func CalculateDatasetMerkleRoot

func CalculateDatasetMerkleRoot(dagdir, cachedir string, epoch uint64, saveCache bool) (mtree.Hash, error)
  1. Generate the dataset if needed
  2. Build merkle tree
  3. If saveCache is true, save root merkle tree of 10 levels to disk
  4. Return merkle root

func CalculateProof

func CalculateProof(dagdir string, blockno uint64, index uint32, cache *DatasetMerkleTreeCache) (mtree.Word, []mtree.Hash, error)

func PersistCache

func PersistCache(dirPath string, cache *DatasetMerkleTreeCache) error

func RLPHeader

func RLPHeader(header *types.Header) ([]byte, error)

func RemoveEpochFile

func RemoveEpochFile(cachedir, dagdir string, epoch uint64)

Types

type DatasetMerkleTreeCache

type DatasetMerkleTreeCache struct {
	Epoch       uint64         `json:"epoch"`
	ProofLength uint64         `json:"proof_length"`
	CacheLength uint64         `json:"cache_length"`
	RootHash    mtree.Hash     `json:"root_hash"`
	Proofs      [][]mtree.Hash `json:"proofs"`
}

func LoadCache

func LoadCache(dirPath string, epoch uint64) (*DatasetMerkleTreeCache, error)

func (*DatasetMerkleTreeCache) Print

func (self *DatasetMerkleTreeCache) Print()

Directories

Path Synopsis
Package ethash implements the ethash proof-of-work consensus engine.
Package ethash implements the ethash proof-of-work consensus engine.

Jump to

Keyboard shortcuts

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