diff --git a/src/base/net/stratum/DaemonClient.cpp b/src/base/net/stratum/DaemonClient.cpp index a6826e67c..0944b6e68 100644 --- a/src/base/net/stratum/DaemonClient.cpp +++ b/src/base/net/stratum/DaemonClient.cpp @@ -64,7 +64,9 @@ xmrig::DaemonClient::~DaemonClient() bool xmrig::DaemonClient::disconnect() { - setState(UnconnectedState); + if (m_state != UnconnectedState) { + setState(UnconnectedState); + } return true; } @@ -82,11 +84,15 @@ bool xmrig::DaemonClient::isTLS() const int64_t xmrig::DaemonClient::submit(const JobResult &result) { - if (result.jobId != (m_blocktemplate.data() + m_blocktemplate.size() - 48)) { + if (result.jobId != (m_blocktemplate.data() + m_blocktemplate.size() - 32)) { return -1; } +# ifdef XMRIG_PROXY_PROJECT + memcpy(m_blocktemplate.data() + 78, result.nonce, 8); +# else Buffer::toHex(reinterpret_cast(&result.nonce), 4, m_blocktemplate.data() + 78); +# endif using namespace rapidjson; Document doc(kObjectType); @@ -190,7 +196,7 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code) job.setHeight(Json::getUint64(params, "height")); job.setDiff(Json::getUint64(params, "difficulty")); - job.setId(blocktemplate.data() + blocktemplate.size() - 48); + job.setId(blocktemplate.data() + blocktemplate.size() - 32); m_job = std::move(job); m_blocktemplate = std::move(blocktemplate); diff --git a/src/base/net/stratum/Job.cpp b/src/base/net/stratum/Job.cpp index 8ef607ad0..663818e2b 100644 --- a/src/base/net/stratum/Job.cpp +++ b/src/base/net/stratum/Job.cpp @@ -185,6 +185,11 @@ void xmrig::Job::setDiff(uint64_t diff) { m_diff = diff; m_target = toDiff(diff); + +# ifdef XMRIG_PROXY_PROJECT + Buffer::toHex(reinterpret_cast(&m_target), 8, m_rawTarget); + m_rawTarget[16] = '\0'; +# endif } diff --git a/src/base/net/stratum/Pool.h b/src/base/net/stratum/Pool.h index 6eec7aa5e..f79877078 100644 --- a/src/base/net/stratum/Pool.h +++ b/src/base/net/stratum/Pool.h @@ -85,6 +85,9 @@ public: inline int keepAlive() const { return m_keepAlive; } inline uint16_t port() const { return m_port; } inline uint64_t pollInterval() const { return m_pollInterval; } + inline void setPassword(const String &password) { m_password = password; } + inline void setRigId(const String &rigId) { m_rigId = rigId; } + inline void setUser(const String &user) { m_user = user; } inline bool operator!=(const Pool &other) const { return !isEqual(other); } inline bool operator==(const Pool &other) const { return isEqual(other); }