mirror of
https://github.com/xmrig/xmrig.git
synced 2025-02-02 11:16:37 +00:00
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
|
@ -4,8 +4,8 @@
|
|||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
*
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -74,6 +74,7 @@ Options:\n\
|
|||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
||||
--no-huge-pages disable huge pages support\n\
|
||||
--no-color disable colored output\n\
|
||||
--no-monero disable Monero v7 PoW\n\
|
||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
||||
--user-agent set custom user-agent string for pool\n\
|
||||
-B, --background run the miner in the background\n\
|
||||
|
@ -118,6 +119,7 @@ static struct option const options[] = {
|
|||
{ "nicehash", 0, nullptr, 1006 },
|
||||
{ "no-color", 0, nullptr, 1002 },
|
||||
{ "no-huge-pages", 0, nullptr, 1009 },
|
||||
{ "no-monero", 0, nullptr, 1010 },
|
||||
{ "pass", 1, nullptr, 'p' },
|
||||
{ "print-time", 1, nullptr, 1007 },
|
||||
{ "retries", 1, nullptr, 'r' },
|
||||
|
@ -158,11 +160,12 @@ static struct option const config_options[] = {
|
|||
|
||||
|
||||
static struct option const pool_options[] = {
|
||||
{ "url", 1, nullptr, 'o' },
|
||||
{ "pass", 1, nullptr, 'p' },
|
||||
{ "url", 1, nullptr, 'o' },
|
||||
{ "user", 1, nullptr, 'u' },
|
||||
{ "userpass", 1, nullptr, 'O' },
|
||||
{ "keepalive", 0, nullptr ,'k' },
|
||||
{ "monero", 0, nullptr, 1010 },
|
||||
{ "nicehash", 0, nullptr, 1006 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
@ -392,6 +395,7 @@ bool Options::parseArg(int key, const char *arg)
|
|||
|
||||
case 1002: /* --no-color */
|
||||
case 1009: /* --no-huge-pages */
|
||||
case 1010: /* --no-monero */
|
||||
return parseBoolean(key, false);
|
||||
|
||||
case 't': /* --threads */
|
||||
|
@ -557,6 +561,10 @@ bool Options::parseBoolean(int key, bool enable)
|
|||
m_hugePages = enable;
|
||||
break;
|
||||
|
||||
case 1010: /* monero */
|
||||
m_pools.back()->setMonero(enable);
|
||||
break;
|
||||
|
||||
case 2000: /* colors */
|
||||
m_colors = enable;
|
||||
break;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
*
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -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…
Reference in a new issue