Sync changes with proxy.

This commit is contained in:
XMRig 2018-04-29 14:24:44 +07:00
parent be232fa1f2
commit 2b0309e159
4 changed files with 46 additions and 1 deletions

View file

@ -71,6 +71,19 @@ static AlgoData const algorithms[] = {
}; };
#ifdef XMRIG_PROXY_PROJECT
static AlgoData const xmrStakAlgorithms[] = {
{ "cryptonight-monerov7", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_1 },
{ "cryptonight_v7", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_1 },
{ "cryptonight_v7_stellite", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL },
{ "cryptonight_lite", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
{ "cryptonight-aeonv7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight_lite_v7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight_lite_v7_xor", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },
};
#endif
static const char *variants[] = { static const char *variants[] = {
"0", "0",
"1", "1",
@ -163,6 +176,27 @@ void xmrig::Algorithm::setAlgo(Algo algo)
} }
#ifdef XMRIG_PROXY_PROJECT
void xmrig::Algorithm::parseXmrStakAlgorithm(const char *algo)
{
m_algo = INVALID_ALGO;
m_variant = VARIANT_AUTO;
for (size_t i = 0; i < ARRAY_SIZE(xmrStakAlgorithms); i++) {
if (strcasecmp(algo, xmrStakAlgorithms[i].name) == 0) {
m_algo = xmrStakAlgorithms[i].algo;
m_variant = xmrStakAlgorithms[i].variant;
break;
}
}
if (m_algo == INVALID_ALGO) {
assert(false);
}
}
#endif
const char *xmrig::Algorithm::name(bool shortName) const const char *xmrig::Algorithm::name(bool shortName) const
{ {
for (size_t i = 0; i < ARRAY_SIZE(algorithms); i++) { for (size_t i = 0; i < ARRAY_SIZE(algorithms); i++) {

View file

@ -49,6 +49,11 @@ public:
setAlgo(algo); setAlgo(algo);
} }
inline Algorithm(const char *algo)
{
parseAlgorithm(algo);
}
bool isEqual(const Algorithm &other) const { return m_algo == other.m_algo && m_variant == other.m_variant; } bool isEqual(const Algorithm &other) const { return m_algo == other.m_algo && m_variant == other.m_variant; }
inline Algo algo() const { return m_algo; } inline Algo algo() const { return m_algo; }
inline const char *name() const { return name(false); } inline const char *name() const { return name(false); }
@ -66,6 +71,10 @@ public:
void parseVariant(int variant); void parseVariant(int variant);
void setAlgo(Algo algo); void setAlgo(Algo algo);
# ifdef XMRIG_PROXY_PROJECT
void parseXmrStakAlgorithm(const char *algo);
# endif
private: private:
const char *name(bool shortName) const; const char *name(bool shortName) const;

View file

@ -80,6 +80,8 @@ private:
}; };
#define RED_BOLD(x) "\e[1;31m" x "\e[0m"
#define RED(x) "\e[0;31m" x "\e[0m"
#define GREEN_BOLD(x) "\e[1;32m" x "\e[0m" #define GREEN_BOLD(x) "\e[1;32m" x "\e[0m"
#define GREEN(x) "\e[0;32m" x "\e[0m" #define GREEN(x) "\e[0;32m" x "\e[0m"
#define MAGENTA_BOLD(x) "\e[1;35m" x "\e[0m" #define MAGENTA_BOLD(x) "\e[1;35m" x "\e[0m"

View file

@ -102,7 +102,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
Value pools(kArrayType); Value pools(kArrayType);
for (const Pool &pool : m_pools) { for (const Pool &pool : m_activePools) {
pools.PushBack(pool.toJSON(doc), allocator); pools.PushBack(pool.toJSON(doc), allocator);
} }