ethash

package
v0.0.0-...-8f649d9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ByzantiumBombDelay = 3000000

ByzantiumBombDelay is the bomb delay for the Byzantium fork

View Source
const ConstantinopleBombDelay = 5000000

ConstantinopleBombDelay is the bomb delay for the Constantinople fork

View Source
const REVISION = 23

REVISION is the spec revision number of Ethash

Variables

This section is empty.

Functions

func Factory

func Factory(ctx context.Context, config *consensus.Config, privateKey *ecdsa.PrivateKey, db storage.Storage, logger hclog.Logger) (consensus.Consensus, error)

Factory is the factory method to create an Ethash consensus

func FrontierDifficulty

func FrontierDifficulty(time int64, parent *types.Header) uint64

FrontierDifficulty is the difficulty calculation for the frontier fork

func HomesteadDifficulty

func HomesteadDifficulty(time int64, parent *types.Header) uint64

HomesteadDifficulty is the difficulty calculation for the homestead fork

func MetropolisDifficulty

func MetropolisDifficulty(time int64, parent *types.Header, bombDelay uint64) uint64

MetropolisDifficulty is the difficulty calculation for the metropolis forks

Types

type Cache

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

Cache is a 16 MB pseudorandom cache.

func (*Cache) Build

func (c *Cache) Build()

Build builds the cache

func (*Cache) Close

func (c *Cache) Close()

Close closes the cache

func (*Cache) Load

func (c *Cache) Load(path string) (bool, error)

Load loads the content of the cache from path

func (*Cache) Save

func (c *Cache) Save(path string) error

Save saves the content of the cache on path

type Ethash

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

Ethash is the ethash consensus algorithm

func (*Ethash) CalcDifficulty

func (e *Ethash) CalcDifficulty(time int64, parent *types.Header) uint64

CalcDifficulty calculates the difficulty at a given time.

func (*Ethash) Close

func (e *Ethash) Close() error

Close closes the connection

func (*Ethash) Prepare

func (e *Ethash) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.

func (*Ethash) Seal

func (e *Ethash) Seal(chain consensus.ChainReader, block *types.Block, ctx context.Context) (*types.Block, error)

Seal seals the block

func (*Ethash) SetDAOBlock

func (e *Ethash) SetDAOBlock(n uint64)

SetDAOBlock sets the dao block, only to be used during tests

func (*Ethash) SetFakePow

func (e *Ethash) SetFakePow()

SetFakePow sets the fakePow flag to true, only used on tests.

func (*Ethash) VerifyHeader

func (e *Ethash) VerifyHeader(chain consensus.ChainReader, header *types.Header, uncle, seal bool) error

VerifyHeader verifies the header is correct

Jump to

Keyboard shortcuts

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