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

A collective of Miners. Miners ask for work, then submit proofs @threadsafe. More...

#include <GenericFarm.h>

Inheritance diagram for dev::eth::GenericFarm< PoW >:
dev::eth::GenericFarmFace< PoW >

Classes

struct  SealerDescriptor
 

Public Types

using WorkPackage = typename PoW::WorkPackage
 
using Solution = typename PoW::Solution
 
using Miner = GenericMiner< PoW >
 
using SolutionFound = std::function< bool(Solution const &)>
 
- Public Types inherited from dev::eth::GenericFarmFace< PoW >
using WorkPackage = typename PoW::WorkPackage
 
using Solution = typename PoW::Solution
 
using Miner = GenericMiner< PoW >
 

Public Member Functions

 ~GenericFarm ()
 
void setWork (WorkPackage const &_wp)
 Sets the current mining mission. More...
 
void setSealers (std::map< std::string, SealerDescriptor > const &_sealers)
 
bool start (std::string const &_sealer)
 Start a number of miners. More...
 
void stop ()
 Stop all mining activities. More...
 
bool isMining () const
 
WorkingProgress const & miningProgress () const
 Get information on the progress of mining this work package. More...
 
void resetMiningProgress ()
 Reset the mining progess counter. More...
 
void onSolutionFound (SolutionFound const &_handler)
 Provides a valid header based upon that received previously with setWork(). More...
 
WorkPackage work () const
 
bool submitProof (Solution const &_s, Miner *_m) override
 Called from a Miner to note a WorkPackage has a solution. More...
 
- Public Member Functions inherited from dev::eth::GenericFarmFace< PoW >
virtual ~GenericFarmFace ()
 

Detailed Description

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

A collective of Miners. Miners ask for work, then submit proofs @threadsafe.

Definition at line 45 of file GenericFarm.h.

Member Typedef Documentation

◆ Miner

template<class PoW >
using dev::eth::GenericFarm< PoW >::Miner = GenericMiner<PoW>

Definition at line 50 of file GenericFarm.h.

◆ Solution

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

Definition at line 49 of file GenericFarm.h.

◆ SolutionFound

template<class PoW >
using dev::eth::GenericFarm< PoW >::SolutionFound = std::function<bool(Solution const&)>

Definition at line 149 of file GenericFarm.h.

◆ WorkPackage

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

Definition at line 48 of file GenericFarm.h.

Constructor & Destructor Documentation

◆ ~GenericFarm()

template<class PoW >
dev::eth::GenericFarm< PoW >::~GenericFarm ( )
inline

Definition at line 58 of file GenericFarm.h.

Member Function Documentation

◆ isMining()

template<class PoW >
bool dev::eth::GenericFarm< PoW >::isMining ( ) const
inline

Definition at line 115 of file GenericFarm.h.

◆ miningProgress()

template<class PoW >
WorkingProgress const& dev::eth::GenericFarm< PoW >::miningProgress ( ) const
inline

Get information on the progress of mining this work package.

Returns
The progress with mining so far.

Definition at line 124 of file GenericFarm.h.

◆ onSolutionFound()

template<class PoW >
void dev::eth::GenericFarm< PoW >::onSolutionFound ( SolutionFound const &  _handler)
inline

Provides a valid header based upon that received previously with setWork().

Parameters
_biThe now-valid header.
Returns
true if the header was good and that the Farm should pause until more work is submitted.

Definition at line 156 of file GenericFarm.h.

◆ resetMiningProgress()

template<class PoW >
void dev::eth::GenericFarm< PoW >::resetMiningProgress ( )
inline

Reset the mining progess counter.

Definition at line 141 of file GenericFarm.h.

◆ setSealers()

template<class PoW >
void dev::eth::GenericFarm< PoW >::setSealers ( std::map< std::string, SealerDescriptor > const &  _sealers)
inline

Definition at line 78 of file GenericFarm.h.

◆ setWork()

template<class PoW >
void dev::eth::GenericFarm< PoW >::setWork ( WorkPackage const &  _wp)
inline

Sets the current mining mission.

Parameters
_wpThe work package we wish to be mining.

Definition at line 67 of file GenericFarm.h.

◆ start()

template<class PoW >
bool dev::eth::GenericFarm< PoW >::start ( std::string const &  _sealer)
inline

Start a number of miners.

Definition at line 83 of file GenericFarm.h.

◆ stop()

template<class PoW >
void dev::eth::GenericFarm< PoW >::stop ( )
inline

Stop all mining activities.

Definition at line 107 of file GenericFarm.h.

◆ submitProof()

template<class PoW >
bool dev::eth::GenericFarm< PoW >::submitProof ( Solution const &  _s,
Miner _m 
)
inlineoverridevirtual

Called from a Miner to note a WorkPackage has a solution.

Parameters
_pThe solution.
_wpThe WorkPackage that the Solution is for.
Returns
true iff the solution was good (implying that mining should be .

Implements dev::eth::GenericFarmFace< PoW >.

Definition at line 166 of file GenericFarm.h.

◆ work()

template<class PoW >
WorkPackage dev::eth::GenericFarm< PoW >::work ( ) const
inline

Definition at line 158 of file GenericFarm.h.


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