mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-03 17:40:13 +00:00
Don't reset when pool sends the same job blob
This commit is contained in:
parent
6346d36d1b
commit
9223c2f027
3 changed files with 14 additions and 1 deletions
|
@ -48,7 +48,13 @@ xmrig::Job::Job(bool nicehash, const Algorithm &algorithm, const String &clientI
|
||||||
|
|
||||||
bool xmrig::Job::isEqual(const Job &other) const
|
bool xmrig::Job::isEqual(const Job &other) const
|
||||||
{
|
{
|
||||||
return m_id == other.m_id && m_clientId == other.m_clientId && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0 && m_target == other.m_target;
|
return m_id == other.m_id && m_clientId == other.m_clientId && isEqualBlob(other) && m_target == other.m_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Job::isEqualBlob(const Job &other) const
|
||||||
|
{
|
||||||
|
return (m_size == other.m_size) && (memcmp(m_blob, other.m_blob, m_size) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
~Job() = default;
|
~Job() = default;
|
||||||
|
|
||||||
bool isEqual(const Job &other) const;
|
bool isEqual(const Job &other) const;
|
||||||
|
bool isEqualBlob(const Job &other) const;
|
||||||
bool setBlob(const char *blob);
|
bool setBlob(const char *blob);
|
||||||
bool setSeedHash(const char *hash);
|
bool setSeedHash(const char *hash);
|
||||||
bool setTarget(const char *target);
|
bool setTarget(const char *target);
|
||||||
|
|
|
@ -561,6 +561,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
||||||
const uint8_t index = donate ? 1 : 0;
|
const uint8_t index = donate ? 1 : 0;
|
||||||
|
|
||||||
d_ptr->reset = !(d_ptr->job.index() == 1 && index == 0 && d_ptr->userJobId == job.id());
|
d_ptr->reset = !(d_ptr->job.index() == 1 && index == 0 && d_ptr->userJobId == job.id());
|
||||||
|
|
||||||
|
// Don't reset nonce if pool sends the same hashing blob again, but with different difficulty (for example)
|
||||||
|
if (d_ptr->job.isEqualBlob(job)) {
|
||||||
|
d_ptr->reset = false;
|
||||||
|
}
|
||||||
|
|
||||||
d_ptr->job = job;
|
d_ptr->job = job;
|
||||||
d_ptr->job.setIndex(index);
|
d_ptr->job.setIndex(index);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue