diff --git a/CMakeLists.txt b/CMakeLists.txt index dd55d11..d435253 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # cmake global cmake_minimum_required(VERSION 2.8.12) -set(PROJECT_VERSION "2.1.20") +set(PROJECT_VERSION "2.1.21") 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/libstratum/EthStratumClient.cpp b/libstratum/EthStratumClient.cpp index d963c0e..0f7e72e 100644 --- a/libstratum/EthStratumClient.cpp +++ b/libstratum/EthStratumClient.cpp @@ -143,6 +143,7 @@ void EthStratumClient::disconnect() if (m_verbose) LogS << "Disconnecting from stratum server"; m_connected = false; + m_authorized = false; m_running = false; m_socket.close(); @@ -301,6 +302,11 @@ void EthStratumClient::submitWork(h256 _nonce, bytes _hash, bytes _challenge, ui Json::Value msg; + if (!isConnected()) { + LogB << "Can't submit share: no stratum connection, or not subscribed"; + return; + } + msg["id"] = 4; msg["method"] = "mining.submit"; msg["params"].append("0x" + _nonce.hex()); @@ -339,7 +345,7 @@ bool EthStratumClient::isRunning() return m_running; } -bool EthStratumClient::isConnected() +bool EthStratumClient::isConnected() { return m_connected && m_authorized; } diff --git a/libstratum/EthStratumClient.h b/libstratum/EthStratumClient.h index 0f18663..4cc375a 100644 --- a/libstratum/EthStratumClient.h +++ b/libstratum/EthStratumClient.h @@ -67,7 +67,6 @@ class EthStratumClient void readResponse(const boost::system::error_code& ec, std::size_t bytes_transferred); void processReponse(Json::Value& responseObject); void writeStratum(Json::Value _json); - void setWork(Json::Value params); void work_timeout_handler(const boost::system::error_code& ec); string streamBufToStr(boost::asio::streambuf &buff); void logJson(Json::Value _json); @@ -78,7 +77,7 @@ class EthStratumClient string m_password; bool m_authorized; // we're subscribed to the pool - bool m_connected; // this refers to a TCP connection + bool m_connected; // this refers to a TCP connection bool m_running; // the Boost::Asio worker thread is running & listening int m_retries = 0;