Browse Source

Fix mining. Again.

cl-refactor
Gav Wood 10 years ago
parent
commit
4251276cb3
  1. 2
      libethash/internal.c
  2. 8
      libethcore/Ethash.cpp
  3. 6
      libethcore/EthashAux.cpp

2
libethash/internal.c

@ -368,7 +368,7 @@ static bool ethash_mmap(struct ethash_full* ret, FILE* f)
if ((fd = ethash_fileno(ret->file)) == -1) {
return false;
}
mmapped_data= mmap(
mmapped_data = mmap(
NULL,
(size_t)ret->file_size + ETHASH_DAG_MAGIC_NUM_SIZE,
PROT_READ | PROT_WRITE,

8
libethcore/Ethash.cpp

@ -142,8 +142,12 @@ void Ethash::CPUMiner::workLoop()
WorkPackage w = work();
EthashAux::FullType dag;
while (!shouldStop() && !(dag = EthashAux::full(w.seedHash, true)))
this_thread::sleep_for(chrono::milliseconds(500));
while (!shouldStop() && !dag)
{
while (!shouldStop() && EthashAux::computeFull(w.seedHash, true) != 100)
this_thread::sleep_for(chrono::milliseconds(500));
dag = EthashAux::full(w.seedHash, false);
}
h256 boundary = w.boundary;
unsigned hashCount = 1;

6
libethcore/EthashAux.cpp

@ -133,7 +133,9 @@ bytesConstRef EthashAux::LightAllocation::data() const
EthashAux::FullAllocation::FullAllocation(ethash_light_t _light, ethash_callback_t _cb)
{
// cdebug << "About to call ethash_full_new...";
full = ethash_full_new(_light, _cb);
// cdebug << "Called OK.";
if (!full)
BOOST_THROW_EXCEPTION(ExternalFunctionFailure("ethash_full_new()"));
}
@ -170,9 +172,9 @@ EthashAux::FullType EthashAux::full(h256 const& _seedHash, bool _createIfMissing
if (_createIfMissing || computeFull(_seedHash, false) == 100)
{
s_dagCallback = _f;
cnote << "Loading from libethash...";
// cnote << "Loading from libethash...";
ret = make_shared<FullAllocation>(l->light, dagCallbackShim);
cnote << "Done loading.";
// cnote << "Done loading.";
DEV_GUARDED(get()->x_fulls)
get()->m_fulls[_seedHash] = get()->m_lastUsedFull = ret;

Loading…
Cancel
Save