CryptonightR support for Wownero

This commit is contained in:
SChernykh 2019-02-10 15:21:17 +01:00
parent 73852f44c6
commit e3f2c38fff
32 changed files with 11251 additions and 131 deletions

View file

@ -354,6 +354,14 @@ bool Client::parseJob(const rapidjson::Value &params, int *code)
}
}
if (params.HasMember("height")) {
const rapidjson::Value &variant = params["height"];
if (variant.IsInt()) {
job.setHeight(variant.GetInt());
}
}
if (!verifyAlgorithm(job.algorithm())) {
*code = 6;

View file

@ -31,7 +31,7 @@
#include "common/net/Job.h"
static inline unsigned char hf_hex2bin(char c, bool &err)
unsigned char hf_hex2bin(char c, bool &err)
{
if (c >= '0' && c <= '9') {
return c - '0';
@ -48,7 +48,7 @@ static inline unsigned char hf_hex2bin(char c, bool &err)
}
static inline char hf_bin2hex(unsigned char c)
char hf_bin2hex(unsigned char c)
{
if (c <= 0x9) {
return '0' + c;
@ -66,7 +66,8 @@ Job::Job() :
m_size(0),
m_diff(0),
m_target(0),
m_blob()
m_blob(),
m_height(0)
{
}
@ -80,6 +81,7 @@ Job::Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmr
m_diff(0),
m_target(0),
m_blob(),
m_height(0),
m_algorithm(algorithm),
m_clientId(clientId)
{
@ -195,6 +197,12 @@ void Job::setAlgorithm(const char *algo)
}
void Job::setHeight(uint64_t height)
{
m_height = height;
}
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
{
bool error = false;

View file

@ -50,6 +50,7 @@ public:
bool setBlob(const char *blob);
bool setTarget(const char *target);
void setAlgorithm(const char *algo);
void setHeight(uint64_t height);
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
@ -65,6 +66,7 @@ public:
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
inline uint32_t diff() const { return static_cast<uint32_t>(m_diff); }
inline uint64_t target() const { return m_target; }
inline uint64_t height() const { return m_height; }
inline void reset() { m_size = 0; m_diff = 0; }
inline void setClientId(const xmrig::Id &id) { m_clientId = id; }
inline void setPoolId(int poolId) { m_poolId = poolId; }
@ -100,6 +102,7 @@ private:
uint64_t m_diff;
uint64_t m_target;
uint8_t m_blob[kMaxBlobSize];
uint64_t m_height;
xmrig::Algorithm m_algorithm;
xmrig::Id m_clientId;
xmrig::Id m_id;

View file

@ -412,6 +412,7 @@ void Pool::rebuild()
m_algorithms.push_back(m_algorithm);
# ifndef XMRIG_PROXY_PROJECT
addVariant(xmrig::VARIANT_WOW);
addVariant(xmrig::VARIANT_2);
addVariant(xmrig::VARIANT_1);
addVariant(xmrig::VARIANT_0);