Better v1 PoW implementation, added variant option.

This commit is contained in:
XMRig 2018-03-12 22:29:44 +07:00
parent 83e5832bc1
commit aec31c43c0
19 changed files with 236 additions and 116 deletions

View file

@ -37,14 +37,16 @@
class Job
{
public:
Job(int poolId = -2, bool nicehash = false, bool monero = true);
Job();
Job(int poolId, bool nicehash, int algo, int variant);
~Job();
bool setBlob(const char *blob);
bool setTarget(const char *target);
int variant() const;
void setCoin(const char *coin);
void setVariant(int variant);
inline bool isMonero() const { return m_monero; }
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
inline bool setId(const char *id) { return m_id.setId(id); }
@ -58,7 +60,6 @@ public:
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
inline uint32_t diff() const { return (uint32_t) m_diff; }
inline uint64_t target() const { return m_target; }
inline uint8_t version() const { return isMonero() ? m_blob[0] : 0; }
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
inline void setThreadId(int threadId) { m_threadId = threadId; }
@ -77,11 +78,12 @@ public:
private:
VAR_ALIGN(16, uint8_t m_blob[84]); // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk.
bool m_monero;
bool m_nicehash;
char m_coin[5];
int m_algo;
int m_poolId;
int m_threadId;
int m_variant;
size_t m_size;
uint64_t m_diff;
uint64_t m_target;