Display backend for shares.

This commit is contained in:
XMRig 2019-10-29 15:43:13 +07:00
parent b1eac17d60
commit 23ebcfb2db
14 changed files with 121 additions and 32 deletions

View file

@ -214,7 +214,7 @@ int64_t xmrig::Client::submit(const JobResult &result)
# ifdef XMRIG_PROXY_PROJECT
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff(), result.id);
# else
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff());
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff(), 0, result.backend);
# endif
return send(doc);

View file

@ -119,7 +119,7 @@ int64_t xmrig::DaemonClient::submit(const JobResult &result)
# ifdef XMRIG_PROXY_PROJECT
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff(), result.id);
# else
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff());
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff(), 0, result.backend);
# endif
send(HTTP_POST, kJsonRPC, doc);

View file

@ -157,6 +157,7 @@ void xmrig::Job::copy(const Job &other)
m_size = other.m_size;
m_clientId = other.m_clientId;
m_id = other.m_id;
m_backend = other.m_backend;
m_diff = other.m_diff;
m_height = other.m_height;
m_target = other.m_target;
@ -174,3 +175,34 @@ void xmrig::Job::copy(const Job &other)
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
}
void xmrig::Job::move(Job &&other)
{
m_algorithm = other.m_algorithm;
m_nicehash = other.m_nicehash;
m_size = other.m_size;
m_clientId = std::move(other.m_clientId);
m_id = std::move(other.m_id);
m_backend = other.m_backend;
m_diff = other.m_diff;
m_height = other.m_height;
m_target = other.m_target;
m_index = other.m_index;
m_seed = std::move(other.m_seed);
m_extraNonce = std::move(other.m_extraNonce);
m_poolWallet = std::move(other.m_poolWallet);
memcpy(m_blob, other.m_blob, sizeof(m_blob));
other.m_size = 0;
other.m_diff = 0;
other.m_algorithm = Algorithm::INVALID;
# ifdef XMRIG_PROXY_PROJECT
m_rawSeedHash = std::move(other.m_rawSeedHash);
memcpy(m_rawBlob, other.m_rawBlob, sizeof(m_rawBlob));
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
}

View file

@ -50,6 +50,10 @@ public:
Job() = default;
Job(bool nicehash, const Algorithm &algorithm, const String &clientId);
inline Job(const Job &other) { copy(other); }
inline Job(Job &&other) noexcept { move(std::move(other)); }
~Job() = default;
bool isEqual(const Job &other) const;
@ -71,6 +75,7 @@ public:
inline const uint8_t *blob() const { return m_blob; }
inline size_t size() const { return m_size; }
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
inline uint32_t backend() const { return m_backend; }
inline uint64_t diff() const { return m_diff; }
inline uint64_t height() const { return m_height; }
inline uint64_t target() const { return m_target; }
@ -79,6 +84,7 @@ public:
inline void reset() { m_size = 0; m_diff = 0; }
inline void setAlgorithm(const Algorithm::Id id) { m_algorithm = id; }
inline void setAlgorithm(const char *algo) { m_algorithm = algo; }
inline void setBackend(uint32_t backend) { m_backend = backend; }
inline void setClientId(const String &id) { m_clientId = id; }
inline void setExtraNonce(const String &extraNonce) { m_extraNonce = extraNonce; }
inline void setHeight(uint64_t height) { m_height = height; }
@ -95,12 +101,14 @@ public:
static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); }
static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; }
inline bool operator==(const Job &other) const { return isEqual(other); }
inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); }
inline Job &operator=(const Job &other) { copy(other); return *this; }
inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; }
private:
void copy(const Job &other);
void move(Job &&other);
Algorithm m_algorithm;
bool m_nicehash = false;
@ -110,6 +118,7 @@ private:
String m_extraNonce;
String m_id;
String m_poolWallet;
uint32_t m_backend = 0;
uint64_t m_diff = 0;
uint64_t m_height = 0;
uint64_t m_target = 0;

View file

@ -37,9 +37,10 @@ class SubmitResult
public:
SubmitResult() = default;
inline SubmitResult(int64_t seq, uint64_t diff, uint64_t actualDiff, int64_t reqId = 0) :
inline SubmitResult(int64_t seq, uint64_t diff, uint64_t actualDiff, int64_t reqId, uint32_t backend) :
reqId(reqId),
seq(seq),
backend(backend),
actualDiff(actualDiff),
diff(diff),
m_start(Chrono::steadyMSecs())
@ -49,6 +50,7 @@ public:
int64_t reqId = 0;
int64_t seq = 0;
uint32_t backend = 0;
uint64_t actualDiff = 0;
uint64_t diff = 0;
uint64_t elapsed = 0;