RandomWOW support

This commit is contained in:
SChernykh 2019-06-15 22:53:03 +02:00
parent 277f188cd5
commit ac1b554282
14 changed files with 157 additions and 3 deletions

View file

@ -344,6 +344,14 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
}
}
if (params.HasMember("seed_hash")) {
const rapidjson::Value &variant = params["seed_hash"];
if (variant.IsString()) {
job.setSeedHash(variant.GetString());
}
}
if (params.HasMember("height")) {
const rapidjson::Value &variant = params["height"];

View file

@ -220,6 +220,8 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
return false;
}
job.setSeedHash(Json::getString(params, "seed_hash"));
job.setHeight(Json::getUint64(params, kHeight));
job.setDiff(Json::getUint64(params, "difficulty"));
job.setId(blocktemplate.data() + blocktemplate.size() - 32);

View file

@ -42,6 +42,7 @@ xmrig::Job::Job() :
m_diff(0),
m_height(0),
m_target(0),
m_seedHash(),
m_blob()
{
}
@ -58,6 +59,7 @@ xmrig::Job::Job(int poolId, bool nicehash, const Algorithm &algorithm, const Str
m_diff(0),
m_height(0),
m_target(0),
m_seedHash(),
m_blob()
{
}
@ -175,6 +177,15 @@ void xmrig::Job::setDiff(uint64_t diff)
}
bool xmrig::Job::setSeedHash(const char *hash)
{
if (!hash || (strlen(hash) != sizeof(m_seedHash) * 2))
return false;
return Buffer::fromHex(hash, sizeof(m_seedHash) * 2, m_seedHash);
}
xmrig::Variant xmrig::Job::variant() const
{
switch (m_algorithm.algo()) {

View file

@ -55,6 +55,7 @@ public:
bool setTarget(const char *target);
void setAlgorithm(const char *algo);
void setDiff(uint64_t diff);
bool setSeedHash(const char *hash);
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
@ -64,6 +65,7 @@ public:
inline const String &id() const { return m_id; }
inline const uint32_t *nonce() const { return reinterpret_cast<const uint32_t*>(m_blob + 39); }
inline const uint8_t *blob() const { return m_blob; }
inline const uint8_t *seed_hash() const { return m_seedHash; }
inline int poolId() const { return m_poolId; }
inline int threadId() const { return m_threadId; }
inline size_t size() const { return m_size; }
@ -106,6 +108,7 @@ private:
uint64_t m_diff;
uint64_t m_height;
uint64_t m_target;
uint8_t m_seedHash[32];
uint8_t m_blob[kMaxBlobSize];
# ifdef XMRIG_PROXY_PROJECT

View file

@ -517,6 +517,7 @@ void xmrig::Pool::rebuild()
addVariant(VARIANT_RWZ);
addVariant(VARIANT_ZLS);
addVariant(VARIANT_DOUBLE);
addVariant(VARIANT_RX_WOW);
addVariant(VARIANT_AUTO);
# endif
}