Documentation
¶
Index ¶
- type Config
- type Mode
- type Pow
- func (pow *Pow) Author(header *types.Header) (common.Address, error)
- func (pow *Pow) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (pow *Pow) Finalize(chain consensus.ChainReader, header *types.Header, txs []*types.Transaction) (*types.Block, error)
- func (pow *Pow) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (pow *Pow) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (pow *Pow) SetThreads(threads int)
- func (pow *Pow) Threads() int
- func (pow *Pow) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (pow *Pow) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (pow *Pow) VerifySeal(chain consensus.ChainReader, header *types.Header) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 Mode ¶
type Mode uint
Mode defines the type and amount of PoW verification an ethash engine makes.
type Pow ¶
type Pow struct {
// contains filtered or unexported fields
}
Pow is a consensus engine based on proot-of-work
func (*Pow) Author ¶
Author implements consensus.Engine, returning the header's coinbase as the proof-of-work verified author of the block.
func (*Pow) CalcDifficulty ¶
func (pow *Pow) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have when created at time given the parent block's time and difficulty.
func (*Pow) Finalize ¶
func (pow *Pow) Finalize(chain consensus.ChainReader, header *types.Header, txs []*types.Transaction) (*types.Block, error)
Finalize implements consensus.Engine, accumulating the block rewards, assembling the block.
func (*Pow) Prepare ¶
Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to protocol.
func (*Pow) Seal ¶
func (pow *Pow) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
Seal implements consensus.Engine, attempting to find a nonce that satisfies the block's difficulty requirements.
func (*Pow) SetThreads ¶
SetThreads updates the number of mining threads currently enabled. Calling this method does not start mining, only sets the thread count. If zero is specified, the miner will use all cores of the machine. Setting a thread count below zero is allowed and will cause the miner to idle, without any work being done.
func (*Pow) Threads ¶
Threads returns the number of mining threads currently enabled. This doesn't necessarily mean that mining is running!
func (*Pow) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules of the PoW engine.
func (*Pow) VerifyHeaders ¶
func (pow *Pow) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.
func (*Pow) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the given block satisfies the PoW difficulty requirements.