From a6f80e6f973f249f61d565e3c3c0a37918bb7cfb Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 18 May 2015 12:42:21 +0200 Subject: [PATCH] Use straight homedirectory rather than Application Support. --- libethcore/EthashAux.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libethcore/EthashAux.cpp b/libethcore/EthashAux.cpp index 59155610f..2c96c3ff0 100644 --- a/libethcore/EthashAux.cpp +++ b/libethcore/EthashAux.cpp @@ -181,10 +181,18 @@ EthashAux::FullType EthashAux::full(h256 const& _seedHash, bool _createIfMissing return ret; } +#define DEV_IF_THROWS(X) try { X; } catch (...) + unsigned EthashAux::computeFull(h256 const& _seedHash) { Guard l(get()->x_fulls); - uint64_t blockNumber = EthashAux::number(_seedHash); + uint64_t blockNumber; + + DEV_IF_THROWS(blockNumber = EthashAux::number(_seedHash)) + { + return 0; + } + if (FullType ret = get()->m_fulls[_seedHash].lock()) { get()->m_lastUsedFull = ret; @@ -232,5 +240,8 @@ Ethash::Result EthashAux::eval(h256 const& _seedHash, h256 const& _headerHash, N { if (FullType dag = get()->m_fulls[_seedHash].lock()) return dag->compute(_headerHash, _nonce); - return EthashAux::get()->light(_seedHash)->compute(_headerHash, _nonce); + DEV_IF_THROWS(return EthashAux::get()->light(_seedHash)->compute(_headerHash, _nonce)) + { + return Ethash::Result(~h256(), h256()); + } }