From f35a5ca84d4c369dcecb91bd34c1a859ad1a50d5 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 21 May 2015 20:43:35 +0200 Subject: [PATCH] fix mining in tests --- libethcore/Ethash.cpp | 2 +- libethcore/Miner.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index 228f03f8e..24a6ab41e 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -142,7 +142,7 @@ void Ethash::CPUMiner::workLoop() WorkPackage w = work(); EthashAux::FullType dag; - while (!shouldStop() && !(dag = EthashAux::full(w.seedHash))) + while (!shouldStop() && !(dag = EthashAux::full(w.seedHash, true))) this_thread::sleep_for(chrono::milliseconds(500)); h256 boundary = w.boundary; diff --git a/libethcore/Miner.h b/libethcore/Miner.h index cede34475..11b9ae140 100644 --- a/libethcore/Miner.h +++ b/libethcore/Miner.h @@ -44,7 +44,7 @@ struct MiningProgress // MiningProgress& operator+=(MiningProgress const& _mp) { hashes += _mp.hashes; ms = std::max(ms, _mp.ms); return *this; } uint64_t hashes = 0; ///< Total number of hashes computed. uint64_t ms = 0; ///< Total number of milliseconds of mining thus far. - uint64_t rate() const { return hashes * 1000 / ms; } + uint64_t rate() const { return ms == 0 ? 0 : hashes * 1000 / ms; } }; struct MineInfo: public MiningProgress {};