Added option to disable Monero v7 PoW, may useful in future if other coins update their network to v7 without PoW change.
This commit is contained in:
parent
8a6988d381
commit
69b8a4faf1
7 changed files with 34 additions and 11 deletions
|
@ -220,7 +220,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
Job job(m_id, m_url.isNicehash());
|
||||
Job job(m_id, m_url.isNicehash(), m_url.isMonero());
|
||||
if (!job.setId(params["job_id"].GetString())) {
|
||||
*code = 3;
|
||||
return false;
|
||||
|
|
|
@ -56,7 +56,8 @@ static inline char hf_bin2hex(unsigned char c)
|
|||
}
|
||||
|
||||
|
||||
Job::Job(int poolId, bool nicehash) :
|
||||
Job::Job(int poolId, bool nicehash, bool monero) :
|
||||
m_monero(monero),
|
||||
m_nicehash(nicehash),
|
||||
m_poolId(poolId),
|
||||
m_threadId(-1),
|
||||
|
|
|
@ -37,12 +37,13 @@
|
|||
class Job
|
||||
{
|
||||
public:
|
||||
Job(int poolId = -2, bool nicehash = false);
|
||||
Job(int poolId = -2, bool nicehash = false, bool monero = true);
|
||||
~Job();
|
||||
|
||||
bool setBlob(const char *blob);
|
||||
bool setTarget(const char *target);
|
||||
|
||||
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); }
|
||||
|
@ -55,7 +56,7 @@ 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 m_blob[0]; }
|
||||
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; }
|
||||
|
||||
|
@ -74,6 +75,7 @@ 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;
|
||||
int m_poolId;
|
||||
int m_threadId;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
Url::Url() :
|
||||
m_keepAlive(false),
|
||||
m_monero(true),
|
||||
m_nicehash(false),
|
||||
m_host(nullptr),
|
||||
m_password(nullptr),
|
||||
|
@ -60,6 +61,7 @@ Url::Url() :
|
|||
*/
|
||||
Url::Url(const char *url) :
|
||||
m_keepAlive(false),
|
||||
m_monero(true),
|
||||
m_nicehash(false),
|
||||
m_host(nullptr),
|
||||
m_password(nullptr),
|
||||
|
@ -71,8 +73,9 @@ Url::Url(const char *url) :
|
|||
}
|
||||
|
||||
|
||||
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool keepAlive, bool nicehash) :
|
||||
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool keepAlive, bool nicehash, bool monero) :
|
||||
m_keepAlive(keepAlive),
|
||||
m_monero(monero),
|
||||
m_nicehash(nicehash),
|
||||
m_password(password ? strdup(password) : nullptr),
|
||||
m_user(user ? strdup(user) : nullptr),
|
||||
|
@ -218,6 +221,7 @@ bool Url::operator==(const Url &other) const
|
|||
Url &Url::operator=(const Url *other)
|
||||
{
|
||||
m_keepAlive = other->m_keepAlive;
|
||||
m_monero = other->m_monero;
|
||||
m_nicehash = other->m_nicehash;
|
||||
m_port = other->m_port;
|
||||
|
||||
|
@ -227,6 +231,11 @@ Url &Url::operator=(const Url *other)
|
|||
setPassword(other->m_password);
|
||||
setUser(other->m_user);
|
||||
|
||||
if (m_url) {
|
||||
delete [] m_url;
|
||||
m_url = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,10 +37,11 @@ public:
|
|||
|
||||
Url();
|
||||
Url(const char *url);
|
||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool keepAlive = false, bool nicehash = false );
|
||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool keepAlive = false, bool nicehash = false, bool monero = true);
|
||||
~Url();
|
||||
|
||||
inline bool isKeepAlive() const { return m_keepAlive; }
|
||||
inline bool isMonero() const { return m_monero; }
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_host && m_port > 0; }
|
||||
inline const char *host() const { return m_host; }
|
||||
|
@ -48,6 +49,7 @@ public:
|
|||
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
|
||||
inline void setMonero(bool monero) { m_monero = monero; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
|
||||
bool parse(const char *url);
|
||||
|
@ -64,6 +66,7 @@ private:
|
|||
bool parseIPv6(const char *addr);
|
||||
|
||||
bool m_keepAlive;
|
||||
bool m_monero;
|
||||
bool m_nicehash;
|
||||
char *m_host;
|
||||
char *m_password;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue