Refactoring
This commit is contained in:
parent
be7ff62c48
commit
4643742d13
9 changed files with 39 additions and 64 deletions
|
@ -162,7 +162,7 @@ int64_t xmrig::Client::submit(const JobResult &result)
|
|||
Buffer::toHex(reinterpret_cast<const char*>(&result.nonce), 4, nonce);
|
||||
nonce[8] = '\0';
|
||||
|
||||
Buffer::toHex(result.result, 32, data);
|
||||
Buffer::toHex(result.result(), 32, data);
|
||||
data[64] = '\0';
|
||||
# endif
|
||||
|
||||
|
@ -313,7 +313,7 @@ bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
Job job(m_id, has<EXT_NICEHASH>(), m_pool.algorithm(), m_rpcId);
|
||||
Job job(has<EXT_NICEHASH>(), m_pool.algorithm(), m_rpcId);
|
||||
|
||||
if (!job.setId(params["job_id"].GetString())) {
|
||||
*code = 3;
|
||||
|
|
|
@ -212,7 +212,7 @@ bool xmrig::DaemonClient::isOutdated(uint64_t height, const char *hash) const
|
|||
|
||||
bool xmrig::DaemonClient::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||
{
|
||||
Job job(m_id, false, m_pool.algorithm(), String());
|
||||
Job job(false, m_pool.algorithm(), String());
|
||||
|
||||
String blocktemplate = Json::getString(params, kBlocktemplateBlob);
|
||||
if (blocktemplate.isNull() || !job.setBlob(Json::getString(params, "blockhashing_blob"))) {
|
||||
|
|
|
@ -34,27 +34,16 @@
|
|||
|
||||
|
||||
xmrig::Job::Job() :
|
||||
m_nicehash(false),
|
||||
m_poolId(-2),
|
||||
m_size(0),
|
||||
m_diff(0),
|
||||
m_height(0),
|
||||
m_target(0),
|
||||
m_blob(),
|
||||
m_seedHash()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
xmrig::Job::Job(int poolId, bool nicehash, const Algorithm &algorithm, const String &clientId) :
|
||||
xmrig::Job::Job(bool nicehash, const Algorithm &algorithm, const String &clientId) :
|
||||
m_algorithm(algorithm),
|
||||
m_nicehash(nicehash),
|
||||
m_poolId(poolId),
|
||||
m_size(0),
|
||||
m_clientId(clientId),
|
||||
m_diff(0),
|
||||
m_height(0),
|
||||
m_target(0),
|
||||
m_blob(),
|
||||
m_seedHash()
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
static constexpr const size_t kMaxBlobSize = 128;
|
||||
|
||||
Job();
|
||||
Job(int poolId, bool nicehash, const Algorithm &algorithm, const String &clientId);
|
||||
Job(bool nicehash, const Algorithm &algorithm, const String &clientId);
|
||||
~Job();
|
||||
|
||||
bool isEqual(const Job &other) const;
|
||||
|
@ -65,18 +65,18 @@ public:
|
|||
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 *seedHash() const { return m_seedHash; }
|
||||
inline int poolId() const { return m_poolId; }
|
||||
inline size_t size() const { return m_size; }
|
||||
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
|
||||
inline uint64_t diff() const { return m_diff; }
|
||||
inline uint64_t height() const { return m_height; }
|
||||
inline uint64_t target() const { return m_target; }
|
||||
inline uint8_t fixedByte() const { return *(m_blob + 42); }
|
||||
inline uint8_t index() const { return m_index; }
|
||||
inline void reset() { m_size = 0; m_diff = 0; }
|
||||
inline void setAlgorithm(const char *algo) { m_algorithm = algo; }
|
||||
inline void setClientId(const String &id) { m_clientId = id; }
|
||||
inline void setHeight(uint64_t height) { m_height = height; }
|
||||
inline void setPoolId(int poolId) { m_poolId = poolId; }
|
||||
inline void setIndex(uint8_t index) { m_index = index; }
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
inline char *rawBlob() { return m_rawBlob; }
|
||||
|
@ -93,15 +93,15 @@ public:
|
|||
|
||||
private:
|
||||
Algorithm m_algorithm;
|
||||
bool m_nicehash;
|
||||
int m_poolId;
|
||||
size_t m_size;
|
||||
bool m_nicehash = false;
|
||||
size_t m_size = 0;
|
||||
String m_clientId;
|
||||
String m_id;
|
||||
uint64_t m_diff;
|
||||
uint64_t m_height;
|
||||
uint64_t m_target;
|
||||
uint64_t m_diff = 0;
|
||||
uint64_t m_height = 0;
|
||||
uint64_t m_target = 0;
|
||||
uint8_t m_blob[kMaxBlobSize];
|
||||
uint8_t m_index = 0;
|
||||
uint8_t m_seedHash[32];
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue