Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
dev::eth::GenericMiner< PoW > Class Template Referenceabstract

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

#include <GenericMiner.h>

Collaboration diagram for dev::eth::GenericMiner< PoW >:
[legend]

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. More...
 
bool submitProof (Solution const &_s)
 Notes that the Miner found a solution. More...
 
WorkPackage const & work () const
 
void accumulateHashes (unsigned _n)
 

Private Attributes

FarmFacem_farm = nullptr
 
unsigned m_index
 
uint64_t m_hashCount = 0
 
WorkPackage m_work
 
Mutex x_work
 

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 43 of file GenericMiner.h.

Member Typedef Documentation

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

Definition at line 79 of file GenericMiner.h.

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

Definition at line 78 of file GenericMiner.h.

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

Definition at line 77 of file GenericMiner.h.

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

Definition at line 76 of file GenericMiner.h.

Constructor & Destructor Documentation

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

Definition at line 81 of file GenericMiner.h.

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

Definition at line 85 of file GenericMiner.h.

Member Function Documentation

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

Definition at line 151 of file GenericMiner.h.

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

Definition at line 108 of file GenericMiner.h.

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

Definition at line 112 of file GenericMiner.h.

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.

Implemented in dev::eth::EthashCPUMiner.

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

No work left to be done.

Pause until told to kickOff().

Implemented in dev::eth::EthashCPUMiner.

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

Definition at line 110 of file GenericMiner.h.

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

Definition at line 89 of file GenericMiner.h.

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 136 of file GenericMiner.h.

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

Definition at line 149 of file GenericMiner.h.

Member Data Documentation

template<class PoW>
FarmFace* dev::eth::GenericMiner< PoW >::m_farm = nullptr
private

Definition at line 154 of file GenericMiner.h.

template<class PoW>
uint64_t dev::eth::GenericMiner< PoW >::m_hashCount = 0
private

Definition at line 157 of file GenericMiner.h.

template<class PoW>
unsigned dev::eth::GenericMiner< PoW >::m_index
private

Definition at line 155 of file GenericMiner.h.

template<class PoW>
WorkPackage dev::eth::GenericMiner< PoW >::m_work
private

Definition at line 159 of file GenericMiner.h.

template<class PoW>
Mutex dev::eth::GenericMiner< PoW >::x_work
mutableprivate

Definition at line 160 of file GenericMiner.h.


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