diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dbca5af7..1c65a1a6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12) set(PROJECT_VERSION "0.9.41") -set(GENOIL_VERSION "1.0.7") +set(GENOIL_VERSION "1.0.8") if (${CMAKE_VERSION} VERSION_GREATER 3.0) cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project() diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 8d7df3f79..1f34eaaeb 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -940,13 +940,19 @@ private: if (EthashAux::eval(current.seedHash, current.headerHash, solution.nonce).value < current.boundary) { bool ok = prpc->eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(current.headerHash), "0x" + toString(solution.mixHash)); - if (ok) + if (ok) { cnote << "B-) Submitted and accepted."; - else + f.acceptedSolution(); + } + else { cwarn << ":-( Not accepted."; + f.rejectedSolution(); + } } - else + else { + f.failedSolution(); cwarn << "FAILURE: GPU gave incorrect result!"; + } current.reset(); } catch (jsonrpc::JsonRpcException&) @@ -1026,7 +1032,7 @@ private: if (client.isConnected()) { if (client.current()) - minelog << "Mining on PoWhash" << client.currentHeaderHash() << ": " << mp; + minelog << "Mining on PoWhash" << client.currentHeaderHash() << ": " << mp << f.getSolutionStats(); else minelog << "Waiting for work package..."; } diff --git a/libethcore/Farm.h b/libethcore/Farm.h index 6c2b7ebd1..5650a31b7 100644 --- a/libethcore/Farm.h +++ b/libethcore/Farm.h @@ -146,6 +146,22 @@ public: resetTimer(); } + SolutionStats getSolutionStats() { + return m_solutionStats; + } + + void failedSolution() { + m_solutionStats.failed(); + } + + void acceptedSolution() { + m_solutionStats.accepted(); + } + + void rejectedSolution() { + m_solutionStats.rejected(); + } + using SolutionFound = std::function; /** @@ -200,7 +216,11 @@ private: std::map m_sealers; std::string m_lastSealer; -}; + + mutable SharedMutex x_solutionStats; + mutable SolutionStats m_solutionStats; + +}; } } diff --git a/libethcore/Miner.h b/libethcore/Miner.h index f17a4084d..795f7f11c 100644 --- a/libethcore/Miner.h +++ b/libethcore/Miner.h @@ -54,6 +54,28 @@ inline std::ostream& operator<<(std::ostream& _out, WorkingProgress _p) return _out; } +class SolutionStats { +public: + void accepted() { accepts++; } + void rejected() { rejects++; } + void failed() { failures++; } + + void reset() { accepts = rejects = failures = 0; } + + unsigned getAccepts() { return accepts; } + unsigned getRejects() { return rejects; } + unsigned getFailures() { return failures; } +private: + unsigned accepts = 0; + unsigned rejects = 0; + unsigned failures = 0; +}; + +inline std::ostream& operator<<(std::ostream& os, SolutionStats s) +{ + return os << "[A" << s.getAccepts() << ":R" << s.getRejects() << ":F" << s.getFailures() << "]"; +} + template class GenericMiner; /** diff --git a/libstratum/EthStratumClient.cpp b/libstratum/EthStratumClient.cpp index c47458a72..3e835692f 100644 --- a/libstratum/EthStratumClient.cpp +++ b/libstratum/EthStratumClient.cpp @@ -259,10 +259,14 @@ void EthStratumClient::processReponse(Json::Value& responseObject) cnote << "Authorized worker " << p_active->user; break; case 4: - if (responseObject.get("result", false).asBool()) + if (responseObject.get("result", false).asBool()) { cnote << "B-) Submitted and accepted."; - else + p_farm->acceptedSolution(); + } + else { cwarn << ":-( Not accepted."; + p_farm->rejectedSolution(); + } break; default: string method = responseObject.get("method", "").asString(); @@ -346,9 +350,10 @@ bool EthStratumClient::submit(EthashProofOfWork::Solution solution) { boost::asio::placeholders::error)); return true; } - else + else { cwarn << "FAILURE: GPU gave incorrect result!"; - + p_farm->rejectedSolution(); + } return false; }