xmrig v2.12.0 rebase
This commit is contained in:
commit
a6630e8aed
58 changed files with 12432 additions and 244 deletions
|
@ -4,8 +4,9 @@
|
|||
* 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 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -35,6 +36,10 @@
|
|||
# define bit_AES (1 << 25)
|
||||
#endif
|
||||
|
||||
#ifndef bit_AVX2
|
||||
# define bit_AVX2 (1 << 5)
|
||||
#endif
|
||||
|
||||
|
||||
#include "common/cpu/BasicCpuInfo.h"
|
||||
|
||||
|
@ -93,9 +98,19 @@ static inline bool has_aes_ni()
|
|||
}
|
||||
|
||||
|
||||
static inline bool has_avx2()
|
||||
{
|
||||
int32_t cpu_info[4] = { 0 };
|
||||
cpuid(EXTENDED_FEATURES, cpu_info);
|
||||
|
||||
return (cpu_info[EBX_Reg] & bit_AVX2) != 0;
|
||||
}
|
||||
|
||||
|
||||
xmrig::BasicCpuInfo::BasicCpuInfo() :
|
||||
m_assembly(ASM_NONE),
|
||||
m_aes(has_aes_ni()),
|
||||
m_avx2(has_avx2()),
|
||||
m_brand(),
|
||||
m_threads(std::thread::hardware_concurrency())
|
||||
{
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
* 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 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -41,6 +42,7 @@ protected:
|
|||
|
||||
inline Assembly assembly() const override { return m_assembly; }
|
||||
inline bool hasAES() const override { return m_aes; }
|
||||
inline bool hasAVX2() const override { return m_avx2; }
|
||||
inline bool isSupported() const override { return true; }
|
||||
inline const char *brand() const override { return m_brand; }
|
||||
inline int32_t cores() const override { return -1; }
|
||||
|
@ -59,6 +61,7 @@ protected:
|
|||
private:
|
||||
Assembly m_assembly;
|
||||
bool m_aes;
|
||||
bool m_avx2;
|
||||
char m_brand[64];
|
||||
int32_t m_threads;
|
||||
};
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
* 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 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -24,19 +25,29 @@
|
|||
#include <string.h>
|
||||
#include <thread>
|
||||
|
||||
#if __ARM_FEATURE_CRYPTO
|
||||
# include <sys/auxv.h>
|
||||
# include <asm/hwcap.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "common/cpu/BasicCpuInfo.h"
|
||||
|
||||
|
||||
xmrig::BasicCpuInfo::BasicCpuInfo() :
|
||||
m_aes(false),
|
||||
m_avx2(false),
|
||||
m_brand(),
|
||||
m_threads(std::thread::hardware_concurrency())
|
||||
{
|
||||
memcpy(m_brand, "Unknown", 7);
|
||||
# ifdef XMRIG_ARMv8
|
||||
memcpy(m_brand, "ARMv8", 5);
|
||||
# else
|
||||
memcpy(m_brand, "ARMv7", 5);
|
||||
# endif
|
||||
|
||||
# if __ARM_FEATURE_CRYPTO
|
||||
m_aes = true;
|
||||
m_aes = getauxval(AT_HWCAP) & HWCAP_AES;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ static AlgoData const algorithms[] = {
|
|||
{ "cryptonight/2", "cn/2", xmrig::CRYPTONIGHT, xmrig::VARIANT_2 },
|
||||
{ "cryptonight/half", "cn/half", xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF },
|
||||
{ "cryptonight/xtlv9", "cn/xtlv9", xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF },
|
||||
{ "cryptonight/wow", "cn/wow", xmrig::CRYPTONIGHT, xmrig::VARIANT_WOW },
|
||||
|
||||
# ifndef XMRIG_NO_AEON
|
||||
{ "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
|
||||
|
@ -87,6 +88,10 @@ static AlgoData const algorithms[] = {
|
|||
{ "cryptonight-ultralite", "cn-ultralite", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
|
||||
{ "cryptonight_turtle", "cn_turtle", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_CN_GPU
|
||||
{ "cryptonight/gpu", "cn/gpu", xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU },
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -106,6 +111,8 @@ static AlgoData const xmrStakAlgorithms[] = {
|
|||
{ "cryptonight_masari", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
|
||||
{ "cryptonight-bittube2", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE }, // bittube-miner
|
||||
{ "cryptonight_alloy", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO }, // xmr-stak-alloy
|
||||
{ "cryptonight_turtle", nullptr, xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL },
|
||||
{ "cryptonight_gpu", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU },
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -121,7 +128,9 @@ static const char *variants[] = {
|
|||
"rto",
|
||||
"2",
|
||||
"half",
|
||||
"trtl"
|
||||
"trtl",
|
||||
"gpu",
|
||||
"wow",
|
||||
};
|
||||
|
||||
|
||||
|
@ -286,6 +295,8 @@ const char *xmrig::Algorithm::perfAlgoName(const xmrig::PerfAlgo pa) {
|
|||
"cn",
|
||||
"cn/2",
|
||||
"cn/half",
|
||||
"cn/gpu",
|
||||
"cn/wow",
|
||||
"cn-lite",
|
||||
"cn-heavy",
|
||||
"cn-pico",
|
||||
|
@ -308,6 +319,14 @@ xmrig::Algorithm::Algorithm(const xmrig::PerfAlgo pa) {
|
|||
m_algo = xmrig::CRYPTONIGHT;
|
||||
m_variant = xmrig::VARIANT_HALF;
|
||||
break;
|
||||
case PA_CN_GPU:
|
||||
m_algo = xmrig::CRYPTONIGHT;
|
||||
m_variant = xmrig::VARIANT_GPU;
|
||||
break;
|
||||
case PA_CN_WOW:
|
||||
m_algo = xmrig::CRYPTONIGHT;
|
||||
m_variant = xmrig::VARIANT_WOW;
|
||||
break;
|
||||
case PA_CN_LITE:
|
||||
m_algo = xmrig::CRYPTONIGHT_LITE;
|
||||
m_variant = xmrig::VARIANT_1;
|
||||
|
@ -333,6 +352,8 @@ xmrig::PerfAlgo xmrig::Algorithm::perf_algo() const {
|
|||
switch (m_variant) {
|
||||
case VARIANT_2: return PA_CN2;
|
||||
case VARIANT_HALF: return PA_CN_HALF;
|
||||
case VARIANT_GPU: return PA_CN_GPU;
|
||||
case VARIANT_WOW: return PA_CN_WOW;
|
||||
default: return PA_CN;
|
||||
}
|
||||
case CRYPTONIGHT_LITE: return PA_CN_LITE;
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
* 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-2018 XMRig <support@xmrig.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -40,6 +42,7 @@ public:
|
|||
virtual ~ICpuInfo() {}
|
||||
|
||||
virtual bool hasAES() const = 0;
|
||||
virtual bool hasAVX2() const = 0;
|
||||
virtual bool isSupported() const = 0;
|
||||
virtual bool isX64() const = 0;
|
||||
virtual const char *brand() const = 0;
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.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>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -21,8 +22,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __ISTRATEGY_H__
|
||||
#define __ISTRATEGY_H__
|
||||
#ifndef XMRIG_ISTRATEGY_H
|
||||
#define XMRIG_ISTRATEGY_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -31,18 +32,24 @@
|
|||
class JobResult;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
class Algorithm;
|
||||
}
|
||||
|
||||
|
||||
class IStrategy
|
||||
{
|
||||
public:
|
||||
virtual ~IStrategy() {}
|
||||
|
||||
virtual bool isActive() const = 0;
|
||||
virtual int64_t submit(const JobResult &result) = 0;
|
||||
virtual void connect() = 0;
|
||||
virtual void resume() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void tick(uint64_t now) = 0;
|
||||
virtual bool isActive() const = 0;
|
||||
virtual int64_t submit(const JobResult &result) = 0;
|
||||
virtual void connect() = 0;
|
||||
virtual void resume() = 0;
|
||||
virtual void setAlgo(const xmrig::Algorithm &algo) = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void tick(uint64_t now) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // __ISTRATEGY_H__
|
||||
#endif // XMRIG_ISTRATEGY_H
|
||||
|
|
|
@ -77,6 +77,7 @@ private:
|
|||
#define CYAN(x) "\x1B[0;36m" x "\x1B[0m"
|
||||
#define WHITE_BOLD(x) "\x1B[1;37m" x "\x1B[0m"
|
||||
#define WHITE(x) "\x1B[0;37m" x "\x1B[0m"
|
||||
#define GRAY(x) "\x1B[1;30m" x "\x1B[0m"
|
||||
|
||||
|
||||
#define LOG_ERR(x, ...) Log::i()->message(ILogBackend::ERR, x, ##__VA_ARGS__)
|
||||
|
|
|
@ -221,6 +221,10 @@ int64_t Client::submit(const JobResult &result)
|
|||
}
|
||||
# endif
|
||||
|
||||
if (m_job.algorithm().variant() == xmrig::VARIANT_WOW && m_job.id() != result.jobId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
using namespace rapidjson;
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
|
@ -356,6 +360,14 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
}
|
||||
}
|
||||
|
||||
if (params.HasMember("height")) {
|
||||
const rapidjson::Value &variant = params["height"];
|
||||
|
||||
if (variant.IsUint64()) {
|
||||
job.setHeight(variant.GetUint64());
|
||||
}
|
||||
}
|
||||
|
||||
if (!verifyAlgorithm(job.algorithm())) {
|
||||
*code = 6;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "common/net/Job.h"
|
||||
|
||||
|
||||
static inline unsigned char hf_hex2bin(char c, bool &err)
|
||||
unsigned char hf_hex2bin(char c, bool &err)
|
||||
{
|
||||
if (c >= '0' && c <= '9') {
|
||||
return c - '0';
|
||||
|
@ -49,7 +49,7 @@ static inline unsigned char hf_hex2bin(char c, bool &err)
|
|||
}
|
||||
|
||||
|
||||
static inline char hf_bin2hex(unsigned char c)
|
||||
char hf_bin2hex(unsigned char c)
|
||||
{
|
||||
if (c <= 0x9) {
|
||||
return '0' + c;
|
||||
|
@ -67,7 +67,8 @@ Job::Job() :
|
|||
m_size(0),
|
||||
m_diff(0),
|
||||
m_target(0),
|
||||
m_blob()
|
||||
m_blob(),
|
||||
m_height(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ Job::Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmr
|
|||
m_diff(0),
|
||||
m_target(0),
|
||||
m_blob(),
|
||||
m_height(0),
|
||||
m_algorithm(algorithm),
|
||||
m_clientId(clientId)
|
||||
{
|
||||
|
@ -133,6 +135,9 @@ bool Job::setBlob(const char *blob)
|
|||
else if (m_algorithm.variant() == xmrig::VARIANT_MSR && m_blob[0] >= 8) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_HALF);
|
||||
}
|
||||
else if (m_algorithm.variant() == xmrig::VARIANT_WOW && m_blob[0] < 11) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_2);
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
|
@ -202,6 +207,12 @@ void Job::setAlgorithm(const char *algo)
|
|||
}
|
||||
|
||||
|
||||
void Job::setHeight(uint64_t height)
|
||||
{
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
|
||||
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
{
|
||||
bool error = false;
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
// for algo benchmarking to set PoW variant
|
||||
void setAlgorithm(const xmrig::Algorithm& algorithm) { m_algorithm = algorithm; }
|
||||
void setAlgorithm(const char *algo);
|
||||
void setHeight(uint64_t height);
|
||||
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
|
||||
|
@ -69,6 +70,7 @@ public:
|
|||
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
|
||||
inline uint32_t diff() const { return static_cast<uint32_t>(m_diff); }
|
||||
inline uint64_t target() const { return m_target; }
|
||||
inline uint64_t height() const { return m_height; }
|
||||
inline void reset() { m_size = 0; m_diff = 0; }
|
||||
inline void setClientId(const xmrig::Id &id) { m_clientId = id; }
|
||||
inline void setPoolId(int poolId) { m_poolId = poolId; }
|
||||
|
@ -104,6 +106,7 @@ private:
|
|||
uint64_t m_diff;
|
||||
uint64_t m_target;
|
||||
uint8_t m_blob[kMaxBlobSize];
|
||||
uint64_t m_height;
|
||||
xmrig::Algorithm m_algorithm;
|
||||
xmrig::Id m_clientId;
|
||||
xmrig::Id m_id;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||
|
@ -60,6 +60,8 @@ Pool::Pool() :
|
|||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_RTO));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_WOW));
|
||||
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0));
|
||||
|
@ -223,10 +225,10 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
Value obj(kObjectType);
|
||||
|
||||
obj.AddMember("url", StringRef(url()), allocator);
|
||||
obj.AddMember("user", StringRef(user()), allocator);
|
||||
obj.AddMember("pass", StringRef(password()), allocator);
|
||||
obj.AddMember("rig-id", rigId() ? Value(StringRef(rigId())).Move() : Value(kNullType).Move(), allocator);
|
||||
obj.AddMember("url", m_url.toJSON(), allocator);
|
||||
obj.AddMember("user", m_user.toJSON(), allocator);
|
||||
obj.AddMember("pass", m_password.toJSON(), allocator);
|
||||
obj.AddMember("rig-id", m_rigId.toJSON(), allocator);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
obj.AddMember("nicehash", isNicehash(), allocator);
|
||||
|
@ -243,17 +245,20 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
|
|||
case xmrig::VARIANT_AUTO:
|
||||
case xmrig::VARIANT_0:
|
||||
case xmrig::VARIANT_1:
|
||||
case xmrig::VARIANT_2:
|
||||
obj.AddMember("variant", m_algorithm.variant(), allocator);
|
||||
break;
|
||||
|
||||
case xmrig::VARIANT_2:
|
||||
obj.AddMember("variant", 2, allocator);
|
||||
break;
|
||||
|
||||
default:
|
||||
obj.AddMember("variant", StringRef(m_algorithm.variantName()), allocator);
|
||||
break;
|
||||
}
|
||||
|
||||
obj.AddMember("tls", isTLS(), allocator);
|
||||
obj.AddMember("tls-fingerprint", fingerprint() ? Value(StringRef(fingerprint())).Move() : Value(kNullType).Move(), allocator);
|
||||
obj.AddMember("tls-fingerprint", m_fingerprint.toJSON(), allocator);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.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>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -76,6 +77,14 @@ void FailoverStrategy::resume()
|
|||
}
|
||||
|
||||
|
||||
void FailoverStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
{
|
||||
for (Client *client : m_pools) {
|
||||
client->setAlgo(algo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::stop()
|
||||
{
|
||||
for (size_t i = 0; i < m_pools.size(); ++i) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.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>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -21,8 +22,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FAILOVERSTRATEGY_H__
|
||||
#define __FAILOVERSTRATEGY_H__
|
||||
#ifndef XMRIG_FAILOVERSTRATEGY_H
|
||||
#define XMRIG_FAILOVERSTRATEGY_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
@ -42,7 +43,7 @@ class FailoverStrategy : public IStrategy, public IClientListener
|
|||
{
|
||||
public:
|
||||
FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
~FailoverStrategy();
|
||||
~FailoverStrategy() override;
|
||||
|
||||
public:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
|
@ -50,6 +51,7 @@ public:
|
|||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void setAlgo(const xmrig::Algorithm &algo) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
||||
|
@ -71,4 +73,4 @@ private:
|
|||
std::vector<Client*> m_pools;
|
||||
};
|
||||
|
||||
#endif /* __FAILOVERSTRATEGY_H__ */
|
||||
#endif /* XMRIG_FAILOVERSTRATEGY_H */
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.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>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -68,6 +69,12 @@ void SinglePoolStrategy::resume()
|
|||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
{
|
||||
m_client->setAlgo(algo);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::stop()
|
||||
{
|
||||
m_client->disconnect();
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.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>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
|
@ -21,8 +22,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SINGLEPOOLSTRATEGY_H__
|
||||
#define __SINGLEPOOLSTRATEGY_H__
|
||||
#ifndef XMRIG_SINGLEPOOLSTRATEGY_H
|
||||
#define XMRIG_SINGLEPOOLSTRATEGY_H
|
||||
|
||||
|
||||
#include "common/interfaces/IClientListener.h"
|
||||
|
@ -31,14 +32,14 @@
|
|||
|
||||
class Client;
|
||||
class IStrategyListener;
|
||||
class Url;
|
||||
class Pool;
|
||||
|
||||
|
||||
class SinglePoolStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
SinglePoolStrategy(const Pool &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
~SinglePoolStrategy();
|
||||
~SinglePoolStrategy() override;
|
||||
|
||||
public:
|
||||
inline bool isActive() const override { return m_active; }
|
||||
|
@ -46,6 +47,7 @@ public:
|
|||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void setAlgo(const xmrig::Algorithm &algo) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
||||
|
@ -61,4 +63,4 @@ private:
|
|||
IStrategyListener *m_listener;
|
||||
};
|
||||
|
||||
#endif /* __SINGLEPOOLSTRATEGY_H__ */
|
||||
#endif /* XMRIG_SINGLEPOOLSTRATEGY_H */
|
||||
|
|
|
@ -37,18 +37,20 @@ enum Algo {
|
|||
CRYPTONIGHT_LITE, /* CryptoNight (1 MB) */
|
||||
CRYPTONIGHT_HEAVY, /* CryptoNight (4 MB) */
|
||||
CRYPTONIGHT_PICO, /* CryptoNight (256 KB) */
|
||||
CRYPTONIGHT_MAX
|
||||
ALGO_MAX
|
||||
};
|
||||
|
||||
// algorithms that can has different performance
|
||||
enum PerfAlgo {
|
||||
PA_INVALID = -1,
|
||||
PA_CN, /* CryptoNight (Monero) */
|
||||
PA_CN2, /* CryptoNight/2 (Monero) */
|
||||
PA_CN_HALF, /* CryptoNight-Half (Masari) */
|
||||
PA_CN_LITE, /* CryptoNight-Lite (AEON) */
|
||||
PA_CN_HEAVY, /* CryptoNight-Heavy (SUMO) */
|
||||
PA_CN_PICO, /* CryptoNight-Pico (TRTL) */
|
||||
PA_CN, /* cn/0 (Monero) */
|
||||
PA_CN2, /* cn/2 (Monero) */
|
||||
PA_CN_HALF, /* cn/half (MSR) */
|
||||
PA_CN_GPU, /* cn/gpu (RYO) */
|
||||
PA_CN_WOW, /* cn/wow (WOW) */
|
||||
PA_CN_LITE, /* cn-lite/1 (AEON) */
|
||||
PA_CN_HEAVY, /* cn-heavy/0 (LOKI) */
|
||||
PA_CN_PICO, /* cn-pico/trtl (TRTL) */
|
||||
PA_MAX
|
||||
};
|
||||
|
||||
|
@ -85,6 +87,8 @@ enum Variant {
|
|||
VARIANT_2 = 8, // CryptoNight variant 2
|
||||
VARIANT_HALF = 9, // CryptoNight variant 2 with half iterations (Masari/Stellite)
|
||||
VARIANT_TRTL = 10, // CryptoNight Turtle (TRTL)
|
||||
VARIANT_GPU = 11, // CryptoNight-GPU (Ryo)
|
||||
VARIANT_WOW = 12, // CryptoNightR (Wownero)
|
||||
VARIANT_MAX
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue