Merge xmrig v6.18.1 into master

This commit is contained in:
MoneroOcean 2022-10-23 18:33:57 +00:00
commit ea561aca4d
31 changed files with 888 additions and 91 deletions

View file

@ -66,7 +66,6 @@ Storage<DaemonClient> DaemonClient::m_storage;
static const char* kBlocktemplateBlob = "blocktemplate_blob";
static const char* kBlockhashingBlob = "blockhashing_blob";
static const char* kLastError = "lasterror";
static const char *kGetHeight = "/getheight";
static const char *kGetInfo = "/getinfo";
static const char *kHash = "hash";

View file

@ -48,7 +48,13 @@ xmrig::Job::Job(bool nicehash, const Algorithm &algorithm, const String &clientI
bool xmrig::Job::isEqual(const Job &other) const
{
return m_id == other.m_id && m_clientId == other.m_clientId && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0 && m_target == other.m_target;
return m_id == other.m_id && m_clientId == other.m_clientId && isEqualBlob(other) && m_target == other.m_target;
}
bool xmrig::Job::isEqualBlob(const Job &other) const
{
return (m_size == other.m_size) && (memcmp(m_blob, other.m_blob, m_size) == 0);
}
@ -58,19 +64,19 @@ bool xmrig::Job::setBlob(const char *blob)
return false;
}
m_size = strlen(blob);
if (m_size % 2 != 0) {
size_t size = strlen(blob);
if (size % 2 != 0) {
return false;
}
m_size /= 2;
size /= 2;
const size_t minSize = nonceOffset() + nonceSize();
if (m_size < minSize || m_size >= sizeof(m_blob)) {
if (size < minSize || size >= sizeof(m_blob)) {
return false;
}
if (!Cvt::fromHex(m_blob, sizeof(m_blob), blob, m_size * 2)) {
if (!Cvt::fromHex(m_blob, sizeof(m_blob), blob, size * 2)) {
return false;
}
@ -80,9 +86,10 @@ bool xmrig::Job::setBlob(const char *blob)
# ifdef XMRIG_PROXY_PROJECT
memset(m_rawBlob, 0, sizeof(m_rawBlob));
memcpy(m_rawBlob, blob, m_size * 2);
memcpy(m_rawBlob, blob, size * 2);
# endif
m_size = size;
return true;
}

View file

@ -59,6 +59,7 @@ public:
~Job() = default;
bool isEqual(const Job &other) const;
bool isEqualBlob(const Job &other) const;
bool setBlob(const char *blob);
bool setSeedHash(const char *hash);
bool setTarget(const char *target);