ethash

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Modified from go-ethereum under GNU Lesser General Public License

Modified from go-ethereum under GNU Lesser General Public License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCache

func MakeCache(block uint64, dir string)

MakeCache generates a new ethash cache and optionally stores it to disk.

func MakeDataset

func MakeDataset(block uint64, dir string)

MakeDataset generates a new ethash dataset and optionally stores it to disk.

func SeedHash

func SeedHash(block uint64) []byte

SeedHash is the seed to use for generating a verification cache and the mining dataset.

Types

type Config

type Config struct {
	CacheDir       string
	CachesInMem    int
	CachesOnDisk   int
	DatasetDir     string
	DatasetsInMem  int
	DatasetsOnDisk int
	PowMode        Mode
}

Config are the configuration parameters of the ethash.

type Ethash

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

Ethash is a consensus engine based on proof-of-work implementing the ethash algorithm.

func NewTester

func NewTester() *Ethash

NewTester creates a small sized ethash PoW scheme useful only for testing purposes.

type Mode

type Mode uint

Mode defines the type and amount of PoW verification an ethash engine makes.

const (
	ModeNormal Mode = iota
	ModeShared
	ModeTest
	ModeFake
	ModeFullFake
)

type QEthash

type QEthash struct {
	*Ethash
	*consensus.CommonEngine
}

QEthash is our wrapper over geth ethash implementation.

func New

func New(
	config Config,
	diffCalculator consensus.DifficultyCalculator,
	remote bool,
) *QEthash

New returns a Ethash scheme.

func (*QEthash) Finalize

func (q *QEthash) Finalize(chain consensus.ChainReader, header types.IHeader, state *state.StateDB, txs []*types.Transaction,
	receipts []*types.Receipt) (types.IBlock, error)

func (*QEthash) Prepare

func (q *QEthash) Prepare(chain consensus.ChainReader, header types.IHeader) error

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

Jump to

Keyboard shortcuts

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