Sync changes.

This commit is contained in:
XMRig 2019-04-13 19:09:22 +07:00
parent 23b0e3799e
commit 21798edb8b
3 changed files with 17 additions and 3 deletions

View file

@ -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<const uint8_t *>(&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 &params, 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);

View file

@ -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<uint8_t *>(&m_target), 8, m_rawTarget);
m_rawTarget[16] = '\0';
# endif
}

View file

@ -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); }