Ethereum  PoC-8
The C++ Implementation of Ethereum
dev::eth::GenericMiner< PoW > Class Template Referenceabstract

A miner - a member and adoptee of the Farm. More...

#include <GenericMiner.h>

Public Types

using WorkPackage = typename PoW::WorkPackage
 
using Solution = typename PoW::Solution
 
using FarmFace = GenericFarmFace< PoW >
 
using ConstructionInfo = std::pair< FarmFace *, unsigned >
 

Public Member Functions

 GenericMiner (ConstructionInfo const &_ci)
 
virtual ~GenericMiner ()
 
void setWork (WorkPackage const &_work=WorkPackage())
 
uint64_t hashCount () const
 
void resetHashCount ()
 
unsigned index () const
 

Protected Member Functions

virtual void kickOff ()=0
 Begin working on a given work package, discarding any previous work. More...
 
virtual void pause ()=0
 No work left to be done. Pause until told to kickOff(). More...
 
bool submitProof (Solution const &_s)
 Notes that the Miner found a solution. More...
 
WorkPackage const & work () const
 
void accumulateHashes (unsigned _n)
 

Detailed Description

template<class PoW>
class dev::eth::GenericMiner< PoW >

A miner - a member and adoptee of the Farm.

Warning
Not threadsafe. It is assumed Farm will synchronise calls to/from this class.

Definition at line 41 of file GenericMiner.h.

Member Typedef Documentation

◆ ConstructionInfo

template<class PoW >
using dev::eth::GenericMiner< PoW >::ConstructionInfo = std::pair<FarmFace*, unsigned>

Definition at line 77 of file GenericMiner.h.

◆ FarmFace

template<class PoW >
using dev::eth::GenericMiner< PoW >::FarmFace = GenericFarmFace<PoW>

Definition at line 76 of file GenericMiner.h.

◆ Solution

template<class PoW >
using dev::eth::GenericMiner< PoW >::Solution = typename PoW::Solution

Definition at line 75 of file GenericMiner.h.

◆ WorkPackage

template<class PoW >
using dev::eth::GenericMiner< PoW >::WorkPackage = typename PoW::WorkPackage

Definition at line 74 of file GenericMiner.h.

Constructor & Destructor Documentation

◆ GenericMiner()

template<class PoW >
dev::eth::GenericMiner< PoW >::GenericMiner ( ConstructionInfo const &  _ci)
inline

Definition at line 79 of file GenericMiner.h.

◆ ~GenericMiner()

template<class PoW >
virtual dev::eth::GenericMiner< PoW >::~GenericMiner ( )
inlinevirtual

Definition at line 83 of file GenericMiner.h.

Member Function Documentation

◆ accumulateHashes()

template<class PoW >
void dev::eth::GenericMiner< PoW >::accumulateHashes ( unsigned  _n)
inlineprotected

Definition at line 150 of file GenericMiner.h.

◆ hashCount()

template<class PoW >
uint64_t dev::eth::GenericMiner< PoW >::hashCount ( ) const
inline

Definition at line 107 of file GenericMiner.h.

◆ index()

template<class PoW >
unsigned dev::eth::GenericMiner< PoW >::index ( ) const
inline

Definition at line 111 of file GenericMiner.h.

◆ kickOff()

template<class PoW >
virtual void dev::eth::GenericMiner< PoW >::kickOff ( )
protectedpure virtual

Begin working on a given work package, discarding any previous work.

Parameters
_workThe package for which to find a solution.

◆ pause()

template<class PoW >
virtual void dev::eth::GenericMiner< PoW >::pause ( )
protectedpure virtual

No work left to be done. Pause until told to kickOff().

◆ resetHashCount()

template<class PoW >
void dev::eth::GenericMiner< PoW >::resetHashCount ( )
inline

Definition at line 109 of file GenericMiner.h.

◆ setWork()

template<class PoW >
void dev::eth::GenericMiner< PoW >::setWork ( WorkPackage const &  _work = WorkPackage())
inline

Definition at line 87 of file GenericMiner.h.

◆ submitProof()

template<class PoW >
bool dev::eth::GenericMiner< PoW >::submitProof ( Solution const &  _s)
inlineprotected

Notes that the Miner found a solution.

Parameters
_sThe solution.
Returns
true if the solution was correct and that the miner should pause.

Definition at line 135 of file GenericMiner.h.

◆ work()

template<class PoW >
WorkPackage const& dev::eth::GenericMiner< PoW >::work ( ) const
inlineprotected

Definition at line 148 of file GenericMiner.h.


The documentation for this class was generated from the following file: