Browse Source

ensurePrecomputed should respect --no-precompute

cl-refactor
Lefteris Karapetsas 9 years ago
parent
commit
1718d6c648
  1. 4
      libethcore/Ethash.cpp
  2. 2
      libethcore/Ethash.h

4
libethcore/Ethash.cpp

@ -212,6 +212,8 @@ std::string Ethash::name()
return "Ethash";
}
bool Ethash::s_precompute = false;
unsigned Ethash::revision()
{
return ETHASH_REVISION;
@ -219,7 +221,7 @@ unsigned Ethash::revision()
void Ethash::ensurePrecomputed(unsigned _number)
{
if (_number % ETHASH_EPOCH_LENGTH > ETHASH_EPOCH_LENGTH * 9 / 10)
if (s_precompute && _number % ETHASH_EPOCH_LENGTH > ETHASH_EPOCH_LENGTH * 9 / 10)
// 90% of the way to the new epoch
EthashAux::computeFull(EthashAux::seedHash(_number + ETHASH_EPOCH_LENGTH), true);
}

2
libethcore/Ethash.h

@ -49,12 +49,14 @@ class EthashCLHook;
class Ethash
{
public:
static bool s_precompute;
static std::string name();
static unsigned revision();
static SealEngineFace* createSealEngine();
using Nonce = h64;
static void setPrecompute(bool _shouldPrecompute) { s_precompute = _shouldPrecompute; }
static void manuallySubmitWork(SealEngineFace* _engine, h256 const& _mixHash, Nonce _nonce);
static bool isWorking(SealEngineFace* _engine);
static WorkingProgress workingProgress(SealEngineFace* _engine);

Loading…
Cancel
Save