Added initial support for per pool algo option (mining code is broken).
This commit is contained in:
parent
725c767928
commit
d7f42d54ad
18 changed files with 187 additions and 637 deletions
|
@ -60,14 +60,7 @@
|
|||
#include "version.h"
|
||||
|
||||
|
||||
xmrig::BaseConfig::BaseConfig() :
|
||||
m_algorithm(CRYPTONIGHT, VARIANT_AUTO),
|
||||
m_autoSave(true),
|
||||
m_background(false),
|
||||
m_dryRun(false),
|
||||
m_syslog(false),
|
||||
m_upgrade(false),
|
||||
m_watch(true)
|
||||
xmrig::BaseConfig::BaseConfig()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -160,19 +153,7 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
|||
m_http.load(chain.getObject("http"));
|
||||
# endif
|
||||
|
||||
m_algorithm.parseAlgorithm(reader.getString("algo", "cn"));
|
||||
|
||||
m_pools.load(reader.getArray("pools"));
|
||||
m_pools.setDonateLevel(reader.getInt("donate-level", kDefaultDonateLevel));
|
||||
m_pools.setProxyDonate(reader.getInt("donate-over-proxy", Pools::PROXY_DONATE_AUTO));
|
||||
m_pools.setRetries(reader.getInt("retries"));
|
||||
m_pools.setRetryPause(reader.getInt("retry-pause"));
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pools.adjust(m_algorithm);
|
||||
m_pools.load(reader);
|
||||
|
||||
return m_pools.active() > 0;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
inline uint32_t printTime() const { return m_printTime; }
|
||||
|
||||
inline bool isWatch() const override { return m_watch && !m_fileName.isNull(); }
|
||||
inline const Algorithm &algorithm() const override { return m_algorithm; }
|
||||
inline const String &fileName() const override { return m_fileName; }
|
||||
inline void setFileName(const char *fileName) override { m_fileName = fileName; }
|
||||
|
||||
|
@ -69,13 +68,12 @@ public:
|
|||
void printVersions();
|
||||
|
||||
protected:
|
||||
Algorithm m_algorithm;
|
||||
bool m_autoSave;
|
||||
bool m_background;
|
||||
bool m_dryRun;
|
||||
bool m_syslog;
|
||||
bool m_upgrade;
|
||||
bool m_watch;
|
||||
bool m_autoSave = true;
|
||||
bool m_background = false;
|
||||
bool m_dryRun = false;
|
||||
bool m_syslog = false;
|
||||
bool m_upgrade = false;
|
||||
bool m_watch = true;
|
||||
Http m_http;
|
||||
Pools m_pools;
|
||||
String m_apiId;
|
||||
|
|
|
@ -144,7 +144,6 @@ public:
|
|||
virtual bool isWatch() const = 0;
|
||||
virtual bool read(const IJsonReader &reader, const char *fileName) = 0;
|
||||
virtual bool save() = 0;
|
||||
virtual const Algorithm &algorithm() const = 0;
|
||||
virtual const String &fileName() const = 0;
|
||||
virtual void getJSON(rapidjson::Document &doc) const = 0;
|
||||
virtual void setFileName(const char *fileName) = 0;
|
||||
|
|
|
@ -333,17 +333,6 @@ bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
job.setAlgorithm(params["algo"].GetString());
|
||||
}
|
||||
|
||||
if (params.HasMember("variant")) {
|
||||
const rapidjson::Value &variant = params["variant"];
|
||||
|
||||
if (variant.IsInt()) {
|
||||
job.setVariant(variant.GetInt());
|
||||
}
|
||||
else if (variant.IsString()){
|
||||
job.setVariant(variant.GetString());
|
||||
}
|
||||
}
|
||||
|
||||
if (params.HasMember("height")) {
|
||||
const rapidjson::Value &variant = params["height"];
|
||||
|
||||
|
@ -438,7 +427,7 @@ bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm) const
|
|||
}
|
||||
# endif
|
||||
|
||||
if (m_pool.isCompatible(algorithm)) {
|
||||
if (m_pool.algorithm() == algorithm) { // FIXME
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -590,18 +579,18 @@ void xmrig::Client::login()
|
|||
params.AddMember("rigid", m_pool.rigId().toJSON(), allocator);
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_pool.algorithm().variant() != xmrig::VARIANT_AUTO)
|
||||
# endif
|
||||
{
|
||||
Value algo(kArrayType);
|
||||
//# ifdef XMRIG_PROXY_PROJECT FIXME
|
||||
// if (m_pool.algorithm().variant() != xmrig::VARIANT_AUTO)
|
||||
//# endif
|
||||
// {
|
||||
// Value algo(kArrayType);
|
||||
|
||||
for (const auto &a : m_pool.algorithms()) {
|
||||
algo.PushBack(StringRef(a.shortName()), allocator);
|
||||
}
|
||||
// for (const auto &a : m_pool.algorithms()) {
|
||||
// algo.PushBack(StringRef(a.shortName()), allocator);
|
||||
// }
|
||||
|
||||
params.AddMember("algo", algo, allocator);
|
||||
}
|
||||
// params.AddMember("algo", algo, allocator);
|
||||
// }
|
||||
|
||||
m_listener->onLogin(this, doc, params);
|
||||
|
||||
|
|
|
@ -34,10 +34,8 @@
|
|||
|
||||
|
||||
xmrig::Job::Job() :
|
||||
m_autoVariant(false),
|
||||
m_nicehash(false),
|
||||
m_poolId(-2),
|
||||
m_threadId(-1),
|
||||
m_size(0),
|
||||
m_diff(0),
|
||||
m_height(0),
|
||||
|
@ -49,10 +47,8 @@ xmrig::Job::Job() :
|
|||
|
||||
xmrig::Job::Job(int poolId, bool nicehash, const Algorithm &algorithm, const String &clientId) :
|
||||
m_algorithm(algorithm),
|
||||
m_autoVariant(algorithm.variant() == VARIANT_AUTO),
|
||||
m_nicehash(nicehash),
|
||||
m_poolId(poolId),
|
||||
m_threadId(-1),
|
||||
m_size(0),
|
||||
m_clientId(clientId),
|
||||
m_diff(0),
|
||||
|
@ -98,10 +94,6 @@ bool xmrig::Job::setBlob(const char *blob)
|
|||
m_nicehash = true;
|
||||
}
|
||||
|
||||
if (m_autoVariant) {
|
||||
m_algorithm.setVariant(variant());
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
memset(m_rawBlob, 0, sizeof(m_rawBlob));
|
||||
memcpy(m_rawBlob, blob, m_size * 2);
|
||||
|
@ -153,16 +145,6 @@ bool xmrig::Job::setTarget(const char *target)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Job::setAlgorithm(const char *algo)
|
||||
{
|
||||
m_algorithm.parseAlgorithm(algo);
|
||||
|
||||
if (m_algorithm.variant() == xmrig::VARIANT_AUTO) {
|
||||
m_algorithm.setVariant(variant());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Job::setDiff(uint64_t diff)
|
||||
{
|
||||
m_diff = diff;
|
||||
|
@ -173,23 +155,3 @@ void xmrig::Job::setDiff(uint64_t diff)
|
|||
m_rawTarget[16] = '\0';
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
xmrig::Variant xmrig::Job::variant() const
|
||||
{
|
||||
switch (m_algorithm.algo()) {
|
||||
case CRYPTONIGHT:
|
||||
return (m_blob[0] >= 10) ? VARIANT_4 : ((m_blob[0] >= 8) ? VARIANT_2 : VARIANT_1);
|
||||
|
||||
case CRYPTONIGHT_LITE:
|
||||
return VARIANT_1;
|
||||
|
||||
case CRYPTONIGHT_HEAVY:
|
||||
return VARIANT_0;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return m_algorithm.variant();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
bool isEqual(const Job &other) const;
|
||||
bool setBlob(const char *blob);
|
||||
bool setTarget(const char *target);
|
||||
void setAlgorithm(const char *algo);
|
||||
void setDiff(uint64_t diff);
|
||||
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
|
@ -65,7 +64,6 @@ public:
|
|||
inline const uint32_t *nonce() const { return reinterpret_cast<const uint32_t*>(m_blob + 39); }
|
||||
inline const uint8_t *blob() const { return m_blob; }
|
||||
inline int poolId() const { return m_poolId; }
|
||||
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 uint64_t diff() const { return m_diff; }
|
||||
|
@ -73,12 +71,10 @@ public:
|
|||
inline uint64_t target() const { return m_target; }
|
||||
inline uint8_t fixedByte() const { return *(m_blob + 42); }
|
||||
inline void reset() { m_size = 0; m_diff = 0; }
|
||||
inline void setAlgorithm(const char *algo) { m_algorithm = algo; }
|
||||
inline void setClientId(const String &id) { m_clientId = id; }
|
||||
inline void setHeight(uint64_t height) { m_height = height; }
|
||||
inline void setPoolId(int poolId) { m_poolId = poolId; }
|
||||
inline void setThreadId(int threadId) { m_threadId = threadId; }
|
||||
inline void setVariant(const char *variant) { m_algorithm.parseVariant(variant); }
|
||||
inline void setVariant(int variant) { m_algorithm.parseVariant(variant); }
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
inline char *rawBlob() { return m_rawBlob; }
|
||||
|
@ -93,13 +89,9 @@ public:
|
|||
inline bool operator!=(const Job &other) const { return !isEqual(other); }
|
||||
|
||||
private:
|
||||
Variant variant() const;
|
||||
|
||||
Algorithm m_algorithm;
|
||||
bool m_autoVariant;
|
||||
bool m_nicehash;
|
||||
int m_poolId;
|
||||
int m_threadId;
|
||||
size_t m_size;
|
||||
String m_clientId;
|
||||
String m_id;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kAlgo = "algo";
|
||||
static const char *kDaemon = "daemon";
|
||||
static const char *kDaemonPollInterval = "daemon-poll-interval";
|
||||
static const char *kEnabled = "enabled";
|
||||
|
@ -58,7 +59,6 @@ static const char *kRigId = "rig-id";
|
|||
static const char *kTls = "tls";
|
||||
static const char *kUrl = "url";
|
||||
static const char *kUser = "user";
|
||||
static const char *kVariant = "variant";
|
||||
|
||||
const String Pool::kDefaultPassword = "x";
|
||||
const String Pool::kDefaultUser = "x";
|
||||
|
@ -119,6 +119,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
|||
m_rigId = Json::getString(object, kRigId);
|
||||
m_fingerprint = Json::getString(object, kFingerprint);
|
||||
m_pollInterval = Json::getUint64(object, kDaemonPollInterval, kDefaultPollInterval);
|
||||
m_algorithm = Json::getString(object, kAlgo);
|
||||
|
||||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash));
|
||||
|
@ -132,15 +133,6 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
|||
else if (keepalive.IsBool()) {
|
||||
setKeepAlive(keepalive.GetBool());
|
||||
}
|
||||
|
||||
const rapidjson::Value &variant = Json::getValue(object, kVariant);
|
||||
if (variant.IsString()) {
|
||||
algorithm().parseVariant(variant.GetString());
|
||||
}
|
||||
else if (variant.IsInt()) {
|
||||
algorithm().parseVariant(variant.GetInt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,28 +158,6 @@ xmrig::Pool::Pool(const char *host, uint16_t port, const char *user, const char
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Pool::isCompatible(const Algorithm &algorithm) const
|
||||
{
|
||||
if (m_algorithms.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const auto &a : m_algorithms) {
|
||||
if (algorithm == a) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_algorithm.algo() == xmrig::CRYPTONIGHT && algorithm.algo() == xmrig::CRYPTONIGHT) {
|
||||
return m_algorithm.variant() == xmrig::VARIANT_RWZ || m_algorithm.variant() == xmrig::VARIANT_ZLS;
|
||||
}
|
||||
# endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Pool::isEnabled() const
|
||||
{
|
||||
# ifndef XMRIG_FEATURE_TLS
|
||||
|
@ -289,6 +259,7 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
Value obj(kObjectType);
|
||||
|
||||
obj.AddMember(StringRef(kAlgo), StringRef(m_algorithm.shortName()), allocator);
|
||||
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kPass), m_password.toJSON(), allocator);
|
||||
|
@ -305,22 +276,6 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||
obj.AddMember(StringRef(kKeepalive), m_keepAlive, allocator);
|
||||
}
|
||||
|
||||
switch (m_algorithm.variant()) {
|
||||
case VARIANT_AUTO:
|
||||
case VARIANT_0:
|
||||
case VARIANT_1:
|
||||
obj.AddMember(StringRef(kVariant), m_algorithm.variant(), allocator);
|
||||
break;
|
||||
|
||||
case VARIANT_2:
|
||||
obj.AddMember(StringRef(kVariant), 2, allocator);
|
||||
break;
|
||||
|
||||
default:
|
||||
obj.AddMember(StringRef(kVariant), StringRef(m_algorithm.variantName()), allocator);
|
||||
break;
|
||||
}
|
||||
|
||||
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
||||
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
||||
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
||||
|
@ -331,29 +286,6 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Pool::adjust(const Algorithm &algorithm)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
m_algorithm.setAlgo(algorithm.algo());
|
||||
adjustVariant(algorithm.variant());
|
||||
}
|
||||
|
||||
rebuild();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pool::setAlgo(const xmrig::Algorithm &algorithm)
|
||||
{
|
||||
m_algorithm = algorithm;
|
||||
|
||||
rebuild();
|
||||
}
|
||||
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
void xmrig::Pool::print() const
|
||||
{
|
||||
|
@ -391,132 +323,3 @@ bool xmrig::Pool::parseIPv6(const char *addr)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pool::addVariant(xmrig::Variant variant)
|
||||
{
|
||||
const xmrig::Algorithm algorithm(m_algorithm.algo(), variant);
|
||||
if (!algorithm.isValid() || m_algorithm == algorithm) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_algorithms.push_back(algorithm);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pool::adjustVariant(const xmrig::Variant variantHint)
|
||||
{
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
using namespace xmrig;
|
||||
|
||||
if (m_host.contains(".nicehash.com")) {
|
||||
m_flags.set(FLAG_NICEHASH, true);
|
||||
m_keepAlive = false;
|
||||
bool valid = true;
|
||||
|
||||
switch (m_port) {
|
||||
case 3355:
|
||||
case 33355:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonight.");
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
break;
|
||||
|
||||
case 3363:
|
||||
case 33363:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonightv7.");
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
break;
|
||||
|
||||
case 3364:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_HEAVY && m_host.contains("cryptonightheavy.");
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
break;
|
||||
|
||||
case 3367:
|
||||
case 33367:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonightv8.");
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
m_flags.set(FLAG_TLS, m_port > 33000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_host.contains(".minergate.com")) {
|
||||
m_keepAlive = false;
|
||||
bool valid = true;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
|
||||
if (m_host.contains("xmr.pool.")) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT;
|
||||
m_algorithm.setVariant(m_port == 45700 ? VARIANT_AUTO : VARIANT_0);
|
||||
}
|
||||
else if (m_host.contains("aeon.pool.") && m_port == 45690) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_LITE;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (variantHint != VARIANT_AUTO) {
|
||||
m_algorithm.setVariant(variantHint);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.variant() != VARIANT_AUTO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.algo() == CRYPTONIGHT_HEAVY) {
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
}
|
||||
else if (m_algorithm.algo() == CRYPTONIGHT_LITE) {
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pool::rebuild()
|
||||
{
|
||||
m_algorithms.clear();
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_algorithms.push_back(m_algorithm);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
addVariant(VARIANT_4);
|
||||
addVariant(VARIANT_WOW);
|
||||
addVariant(VARIANT_2);
|
||||
addVariant(VARIANT_1);
|
||||
addVariant(VARIANT_0);
|
||||
addVariant(VARIANT_HALF);
|
||||
addVariant(VARIANT_XTL);
|
||||
addVariant(VARIANT_TUBE);
|
||||
addVariant(VARIANT_MSR);
|
||||
addVariant(VARIANT_XHV);
|
||||
addVariant(VARIANT_XAO);
|
||||
addVariant(VARIANT_RTO);
|
||||
addVariant(VARIANT_GPU);
|
||||
addVariant(VARIANT_RWZ);
|
||||
addVariant(VARIANT_ZLS);
|
||||
addVariant(VARIANT_DOUBLE);
|
||||
addVariant(VARIANT_AUTO);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -69,13 +69,11 @@ public:
|
|||
bool tls = false
|
||||
);
|
||||
|
||||
inline Algorithm &algorithm() { return m_algorithm; }
|
||||
inline bool isDaemon() const { return m_flags.test(FLAG_DAEMON); }
|
||||
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
|
||||
inline bool isTLS() const { return m_flags.test(FLAG_TLS); }
|
||||
inline bool isValid() const { return !m_host.isNull() && m_port > 0; }
|
||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const Algorithms &algorithms() const { return m_algorithms; }
|
||||
inline const String &fingerprint() const { return m_fingerprint; }
|
||||
inline const String &host() const { return m_host; }
|
||||
inline const String &password() const { return !m_password.isNull() ? m_password : kDefaultPassword; }
|
||||
|
@ -85,6 +83,7 @@ public:
|
|||
inline int keepAlive() const { return m_keepAlive; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
inline uint64_t pollInterval() const { return m_pollInterval; }
|
||||
inline void setAlgo(const Algorithm &algorithm) { m_algorithm = algorithm; }
|
||||
inline void setPassword(const String &password) { m_password = password; }
|
||||
inline void setRigId(const String &rigId) { m_rigId = rigId; }
|
||||
inline void setUser(const String &user) { m_user = user; }
|
||||
|
@ -92,13 +91,10 @@ public:
|
|||
inline bool operator!=(const Pool &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const Pool &other) const { return isEqual(other); }
|
||||
|
||||
bool isCompatible(const Algorithm &algorithm) const;
|
||||
bool isEnabled() const;
|
||||
bool isEqual(const Pool &other) const;
|
||||
bool parse(const char *url);
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
void adjust(const Algorithm &algorithm);
|
||||
void setAlgo(const Algorithm &algorithm);
|
||||
|
||||
# ifdef APP_DEBUG
|
||||
void print() const;
|
||||
|
@ -109,12 +105,8 @@ private:
|
|||
inline void setKeepAlive(int keepAlive) { m_keepAlive = keepAlive >= 0 ? keepAlive : 0; }
|
||||
|
||||
bool parseIPv6(const char *addr);
|
||||
void addVariant(Variant variant);
|
||||
void adjustVariant(const Variant variantHint);
|
||||
void rebuild();
|
||||
|
||||
Algorithm m_algorithm;
|
||||
Algorithms m_algorithms;
|
||||
int m_keepAlive;
|
||||
std::bitset<FLAG_MAX> m_flags;
|
||||
String m_fingerprint;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IJsonReader.h"
|
||||
#include "base/net/stratum/Pools.h"
|
||||
#include "base/net/stratum/strategies/FailoverStrategy.h"
|
||||
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
||||
|
@ -103,18 +104,11 @@ size_t xmrig::Pools::active() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Pools::adjust(const Algorithm &algorithm)
|
||||
{
|
||||
for (Pool &pool : m_data) {
|
||||
pool.adjust(algorithm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pools::load(const rapidjson::Value &pools)
|
||||
void xmrig::Pools::load(const IJsonReader &reader)
|
||||
{
|
||||
m_data.clear();
|
||||
|
||||
const rapidjson::Value &pools = reader.getArray("pools");
|
||||
if (!pools.IsArray()) {
|
||||
return;
|
||||
}
|
||||
|
@ -129,6 +123,11 @@ void xmrig::Pools::load(const rapidjson::Value &pools)
|
|||
m_data.push_back(std::move(pool));
|
||||
}
|
||||
}
|
||||
|
||||
setDonateLevel(reader.getInt("donate-level", kDefaultDonateLevel));
|
||||
setProxyDonate(reader.getInt("donate-over-proxy", PROXY_DONATE_AUTO));
|
||||
setRetries(reader.getInt("retries"));
|
||||
setRetryPause(reader.getInt("retry-pause"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,11 +135,11 @@ void xmrig::Pools::print() const
|
|||
{
|
||||
size_t i = 1;
|
||||
for (const Pool &pool : m_data) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("POOL #%-7zu") CSI "1;%dm%s" CLEAR " variant " WHITE_BOLD("%s"),
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("POOL #%-7zu") CSI "1;%dm%s" CLEAR " algo " WHITE_BOLD("%s"),
|
||||
i,
|
||||
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
||||
pool.url().data(),
|
||||
pool.algorithm().variantName()
|
||||
pool.algorithm().shortName()
|
||||
);
|
||||
|
||||
i++;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
class IJsonReader;
|
||||
class IStrategy;
|
||||
class IStrategyListener;
|
||||
|
||||
|
@ -63,15 +64,15 @@ public:
|
|||
IStrategy *createStrategy(IStrategyListener *listener) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
size_t active() const;
|
||||
void adjust(const Algorithm &algorithm);
|
||||
void load(const rapidjson::Value &pools);
|
||||
void load(const IJsonReader &reader);
|
||||
void print() const;
|
||||
|
||||
private:
|
||||
void setDonateLevel(int level);
|
||||
void setProxyDonate(int value);
|
||||
void setRetries(int retries);
|
||||
void setRetryPause(int retryPause);
|
||||
|
||||
private:
|
||||
int m_donateLevel;
|
||||
int m_retries;
|
||||
int m_retryPause;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue