64bit diff support.

This commit is contained in:
XMRig 2019-04-10 03:42:00 +07:00
parent c41889477c
commit 1bd8d63508
6 changed files with 18 additions and 18 deletions

View file

@ -67,7 +67,7 @@ public:
inline int threadId() const { return m_threadId; }
inline size_t size() const { return m_size; }
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 height() const { return m_height; }
inline uint64_t target() const { return m_target; }
inline uint8_t fixedByte() const { return *(m_blob + 42); }

View file

@ -38,17 +38,17 @@ public:
inline SubmitResult() :
reqId(0),
seq(0),
diff(0),
actualDiff(0),
diff(0),
elapsed(0),
m_start(0)
{}
inline SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int64_t reqId = 0) :
inline SubmitResult(int64_t seq, uint64_t diff, uint64_t actualDiff, int64_t reqId = 0) :
reqId(reqId),
seq(seq),
diff(diff),
actualDiff(actualDiff),
diff(diff),
elapsed(0),
m_start(Chrono::steadyMSecs())
{}
@ -57,8 +57,8 @@ public:
int64_t reqId;
int64_t seq;
uint32_t diff;
uint64_t actualDiff;
uint64_t diff;
uint64_t elapsed;
private:

View file

@ -41,20 +41,20 @@ namespace xmrig {
class JobResult
{
public:
inline JobResult() : poolId(0), diff(0), nonce(0) {}
inline JobResult(int poolId, const String &jobId, const String &clientId, uint32_t nonce, const uint8_t *result, uint32_t diff, const Algorithm &algorithm) :
inline JobResult() : poolId(0), nonce(0), diff(0) {}
inline JobResult(int poolId, const String &jobId, const String &clientId, uint32_t nonce, const uint8_t *result, uint64_t diff, const Algorithm &algorithm) :
algorithm(algorithm),
poolId(poolId),
clientId(clientId),
jobId(jobId),
diff(diff),
nonce(nonce)
nonce(nonce),
diff(diff)
{
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();
clientId = job.clientId();
@ -75,8 +75,8 @@ public:
int poolId;
String clientId;
String jobId;
uint32_t diff;
uint32_t nonce;
uint64_t diff;
uint8_t result[32];
};

View file

@ -181,11 +181,11 @@ void xmrig::Network::onResultAccepted(IStrategy *, Client *, const SubmitResult
m_state.add(result, error);
if (error) {
LOG_INFO(RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%u") " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
LOG_INFO(RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
m_state.accepted, m_state.rejected, result.diff, error, result.elapsed);
}
else {
LOG_INFO(GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%u") " " BLACK_BOLD("(%" PRIu64 " ms)"),
LOG_INFO(GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " BLACK_BOLD("(%" PRIu64 " ms)"),
m_state.accepted, m_state.rejected, result.diff, result.elapsed);
}
}
@ -194,11 +194,11 @@ void xmrig::Network::onResultAccepted(IStrategy *, Client *, const SubmitResult
void xmrig::Network::setJob(Client *client, const Job &job, bool donate)
{
if (job.height()) {
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
client->host(), client->port(), job.diff(), job.algorithm().shortName(), job.height());
}
else {
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%d") " algo " WHITE_BOLD("%s"),
LOG_INFO(MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s"),
client->host(), client->port(), job.diff(), job.algorithm().shortName());
}

View file

@ -35,14 +35,14 @@
xmrig::NetworkState::NetworkState() :
diff(0),
pool(),
accepted(0),
diff(0),
failures(0),
rejected(0),
total(0),
m_active(false)
{
memset(pool, 0, sizeof(pool));
}

View file

@ -50,8 +50,8 @@ public:
char pool[256];
std::array<uint64_t, 10> topDiff { { } };
uint32_t diff;
uint64_t accepted;
uint64_t diff;
uint64_t failures;
uint64_t rejected;
uint64_t total;