Use block version to detect proper XTL variant and use variant 1 by default for cryptonight.

This commit is contained in:
XMRig 2018-05-03 20:16:42 +07:00
parent 1ab0829ab3
commit 734c0dbce1
2 changed files with 23 additions and 5 deletions

View file

@ -163,6 +163,28 @@ bool Job::setTarget(const char *target)
}
xmrig::Variant Job::variant() const
{
if (m_algorithm.algo() == xmrig::CRYPTONIGHT_HEAVY) {
return xmrig::VARIANT_0;
}
if (m_algorithm.variant() == xmrig::VARIANT_XTL && m_blob[0] < 4) {
return xmrig::VARIANT_1;
}
if (m_algorithm.variant() == xmrig::VARIANT_AUTO) {
if (m_algorithm.algo() == xmrig::CRYPTONIGHT) {
return xmrig::VARIANT_1;
}
return (m_blob[0] > 6 ? xmrig::VARIANT_1 : xmrig::VARIANT_0);
}
return m_algorithm.variant();
}
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
{
bool error = false;

View file

@ -43,6 +43,7 @@ public:
bool setBlob(const char *blob);
bool setTarget(const char *target);
xmrig::Variant variant() const;
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
@ -64,11 +65,6 @@ public:
inline void setThreadId(int threadId) { m_threadId = threadId; }
inline xmrig::Algorithm &algorithm() { return m_algorithm; }
inline xmrig::Variant variant() const
{
return (m_algorithm.variant() == xmrig::VARIANT_AUTO ? (m_blob[0] > 6 ? xmrig::VARIANT_1 : xmrig::VARIANT_0) : m_algorithm.variant());
}
# ifdef XMRIG_PROXY_PROJECT
inline char *rawBlob() { return m_rawBlob; }
inline const char *rawTarget() const { return m_rawTarget; }