Use 64bit diff throughout
This appears to be mainly cosmetic. Difficulty values from the daemon are larger than 32bits, and the value being displayed was being truncated. Doesn't appear to affect mining, which uses the 64bit target.
This commit is contained in:
parent
837c1d7e0d
commit
a6fcf552d4
6 changed files with 19 additions and 19 deletions
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
char pool[256];
|
char pool[256];
|
||||||
std::array<uint64_t, 10> topDiff { { } };
|
std::array<uint64_t, 10> topDiff { { } };
|
||||||
uint32_t diff;
|
uint64_t diff;
|
||||||
uint64_t accepted;
|
uint64_t accepted;
|
||||||
uint64_t failures;
|
uint64_t failures;
|
||||||
uint64_t rejected;
|
uint64_t rejected;
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
inline int threadId() const { return m_threadId; }
|
inline int threadId() const { return m_threadId; }
|
||||||
inline size_t size() const { return m_size; }
|
inline size_t size() const { return m_size; }
|
||||||
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
|
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 diff() const { return m_diff; }
|
||||||
inline uint64_t target() const { return m_target; }
|
inline uint64_t target() const { return m_target; }
|
||||||
inline uint64_t height() const { return m_height; }
|
inline uint64_t height() const { return m_height; }
|
||||||
inline void reset() { m_size = 0; m_diff = 0; }
|
inline void reset() { m_size = 0; m_diff = 0; }
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "common/net/SubmitResult.h"
|
#include "common/net/SubmitResult.h"
|
||||||
|
|
||||||
|
|
||||||
xmrig::SubmitResult::SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int64_t reqId) :
|
xmrig::SubmitResult::SubmitResult(int64_t seq, uint64_t diff, uint64_t actualDiff, int64_t reqId) :
|
||||||
reqId(reqId),
|
reqId(reqId),
|
||||||
seq(seq),
|
seq(seq),
|
||||||
diff(diff),
|
diff(diff),
|
||||||
|
|
|
@ -36,13 +36,13 @@ class SubmitResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline SubmitResult() : reqId(0), seq(0), diff(0), actualDiff(0), elapsed(0), start(0) {}
|
inline SubmitResult() : reqId(0), seq(0), diff(0), actualDiff(0), elapsed(0), start(0) {}
|
||||||
SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int64_t reqId = 0);
|
SubmitResult(int64_t seq, uint64_t diff, uint64_t actualDiff, int64_t reqId = 0);
|
||||||
|
|
||||||
void done();
|
void done();
|
||||||
|
|
||||||
int64_t reqId;
|
int64_t reqId;
|
||||||
int64_t seq;
|
int64_t seq;
|
||||||
uint32_t diff;
|
uint64_t diff;
|
||||||
uint64_t actualDiff;
|
uint64_t actualDiff;
|
||||||
uint64_t elapsed;
|
uint64_t elapsed;
|
||||||
|
|
||||||
|
|
|
@ -40,20 +40,20 @@ namespace xmrig {
|
||||||
class JobResult
|
class JobResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline JobResult() : poolId(0), diff(0), nonce(0) {}
|
inline JobResult() : poolId(0), nonce(0), diff(0) {}
|
||||||
inline JobResult(int poolId, const Id &jobId, const Id &clientId, uint32_t nonce, const uint8_t *result, uint32_t diff, const Algorithm &algorithm) :
|
inline JobResult(int poolId, const Id &jobId, const Id &clientId, uint32_t nonce, const uint8_t *result, uint64_t diff, const Algorithm &algorithm) :
|
||||||
algorithm(algorithm),
|
algorithm(algorithm),
|
||||||
clientId(clientId),
|
clientId(clientId),
|
||||||
jobId(jobId),
|
jobId(jobId),
|
||||||
poolId(poolId),
|
poolId(poolId),
|
||||||
diff(diff),
|
nonce(nonce),
|
||||||
nonce(nonce)
|
diff(diff)
|
||||||
{
|
{
|
||||||
memcpy(this->result, result, sizeof(this->result));
|
memcpy(this->result, result, sizeof(this->result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline JobResult(const Job &job) : poolId(0), diff(0), nonce(0)
|
inline JobResult(const Job &job) : poolId(0), nonce(0), diff(0)
|
||||||
{
|
{
|
||||||
jobId = job.id();
|
jobId = job.id();
|
||||||
clientId = job.clientId();
|
clientId = job.clientId();
|
||||||
|
@ -74,8 +74,8 @@ public:
|
||||||
Id clientId;
|
Id clientId;
|
||||||
Id jobId;
|
Id jobId;
|
||||||
int poolId;
|
int poolId;
|
||||||
uint32_t diff;
|
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
|
uint64_t diff;
|
||||||
uint8_t result[32];
|
uint8_t result[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -163,13 +163,13 @@ void xmrig::Network::onResultAccepted(IStrategy *, Client *, const SubmitResult
|
||||||
m_state.add(result, error);
|
m_state.add(result, error);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
LOG_INFO(isColors() ? "\x1B[1;31mrejected\x1B[0m (%" PRId64 "/%" PRId64 ") diff \x1B[1;37m%u\x1B[0m \x1B[31m\"%s\"\x1B[0m \x1B[1;30m(%" PRIu64 " ms)"
|
LOG_INFO(isColors() ? "\x1B[1;31mrejected\x1B[0m (%" PRId64 "/%" PRId64 ") diff \x1B[1;37m%" PRIu64 "\x1B[0m \x1B[31m\"%s\"\x1B[0m \x1B[1;30m(%" PRIu64 " ms)"
|
||||||
: "rejected (%" PRId64 "/%" PRId64 ") diff %u \"%s\" (%" PRIu64 " ms)",
|
: "rejected (%" PRId64 "/%" PRId64 ") diff %" PRIu64 " \"%s\" (%" PRIu64 " ms)",
|
||||||
m_state.accepted, m_state.rejected, result.diff, error, result.elapsed);
|
m_state.accepted, m_state.rejected, result.diff, error, result.elapsed);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_INFO(isColors() ? "\x1B[1;32maccepted\x1B[0m (%" PRId64 "/%" PRId64 ") diff \x1B[1;37m%u\x1B[0m \x1B[1;30m(%" PRIu64 " ms)"
|
LOG_INFO(isColors() ? "\x1B[1;32maccepted\x1B[0m (%" PRId64 "/%" PRId64 ") diff \x1B[1;37m%" PRIu64 "\x1B[0m \x1B[1;30m(%" PRIu64 " ms)"
|
||||||
: "accepted (%" PRId64 "/%" PRId64 ") diff %u (%" PRIu64 " ms)",
|
: "accepted (%" PRId64 "/%" PRId64 ") diff %" PRIu64 " (%" PRIu64 " ms)",
|
||||||
m_state.accepted, m_state.rejected, result.diff, result.elapsed);
|
m_state.accepted, m_state.rejected, result.diff, result.elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,13 +184,13 @@ bool xmrig::Network::isColors() const
|
||||||
void xmrig::Network::setJob(Client *client, const Job &job, bool donate)
|
void xmrig::Network::setJob(Client *client, const Job &job, bool donate)
|
||||||
{
|
{
|
||||||
if (job.height()) {
|
if (job.height()) {
|
||||||
LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64)
|
LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64)
|
||||||
: "new job from %s:%d diff %d algo %s height %" PRIu64,
|
: "new job from %s:%d diff %" PRIu64 " algo %s height %" PRIu64,
|
||||||
client->host(), client->port(), job.diff(), job.algorithm().shortName(), job.height());
|
client->host(), client->port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s")
|
LOG_INFO(isColors() ? MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s")
|
||||||
: "new job from %s:%d diff %d algo %s",
|
: "new job from %s:%d diff %" PRIu64 " algo %s",
|
||||||
client->host(), client->port(), job.diff(), job.algorithm().shortName());
|
client->host(), client->port(), job.diff(), job.algorithm().shortName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue