#672 Reverted back "cryptonight-light" and exit if no valid algorithm specified.

This commit is contained in:
XMRig 2018-06-04 02:09:29 +07:00
parent 1748a7bd57
commit e320b2e928
5 changed files with 15 additions and 5 deletions

View file

@ -38,6 +38,7 @@
xmrig::CommonConfig::CommonConfig() : xmrig::CommonConfig::CommonConfig() :
m_algorithm(CRYPTONIGHT, VARIANT_AUTO),
m_adjusted(false), m_adjusted(false),
m_apiIPv6(false), m_apiIPv6(false),
m_apiRestricted(true), m_apiRestricted(true),
@ -117,7 +118,7 @@ bool xmrig::CommonConfig::finalize()
} }
if (!m_algorithm.isValid()) { if (!m_algorithm.isValid()) {
m_algorithm.setAlgo(CRYPTONIGHT); return false;
} }
for (Pool &pool : m_pools) { for (Pool &pool : m_pools) {

View file

@ -48,7 +48,6 @@ public:
inline bool isBackground() const { return m_background; } inline bool isBackground() const { return m_background; }
inline bool isColors() const { return m_colors; } inline bool isColors() const { return m_colors; }
inline bool isSyslog() const { return m_syslog; } inline bool isSyslog() const { return m_syslog; }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const char *apiToken() const { return m_apiToken.data(); } inline const char *apiToken() const { return m_apiToken.data(); }
inline const char *apiWorkerId() const { return m_apiWorkerId.data(); } inline const char *apiWorkerId() const { return m_apiWorkerId.data(); }
inline const char *logFile() const { return m_logFile.data(); } inline const char *logFile() const { return m_logFile.data(); }
@ -62,6 +61,7 @@ public:
inline void setColors(bool colors) { m_colors = colors; } inline void setColors(bool colors) { m_colors = colors; }
inline bool isWatch() const override { return m_watch && !m_fileName.isNull(); } inline bool isWatch() const override { return m_watch && !m_fileName.isNull(); }
inline const Algorithm &algorithm() const override { return m_algorithm; }
inline const char *fileName() const override { return m_fileName.data(); } inline const char *fileName() const override { return m_fileName.data(); }
bool save() override; bool save() override;

View file

@ -170,7 +170,13 @@ xmrig::IConfig *xmrig::ConfigLoader::load(int argc, char **argv, IConfigCreator
} }
if (!config->finalize()) { if (!config->finalize()) {
if (!config->algorithm().isValid()) {
fprintf(stderr, "No valid algorithm specified. Exiting.\n");
}
else {
fprintf(stderr, "No valid configuration found. Exiting.\n"); fprintf(stderr, "No valid configuration found. Exiting.\n");
}
delete config; delete config;
return nullptr; return nullptr;
} }

View file

@ -60,6 +60,7 @@ static AlgoData const algorithms[] = {
# ifndef XMRIG_NO_AEON # ifndef XMRIG_NO_AEON
{ "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO }, { "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-light", "cn-light", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 }, { "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
{ "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 }, { "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight-lite/ipbc", "cn-lite/ipbc", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC }, { "cryptonight-lite/ipbc", "cn-lite/ipbc", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },

View file

@ -24,6 +24,7 @@
#define __ICONFIG_H__ #define __ICONFIG_H__
#include "common/crypto/Algorithm.h"
#include "rapidjson/fwd.h" #include "rapidjson/fwd.h"
@ -97,6 +98,7 @@ public:
virtual bool parseString(int key, const char *arg) = 0; virtual bool parseString(int key, const char *arg) = 0;
virtual bool parseUint64(int key, uint64_t arg) = 0; virtual bool parseUint64(int key, uint64_t arg) = 0;
virtual bool save() = 0; virtual bool save() = 0;
virtual const Algorithm &algorithm() const = 0;
virtual const char *fileName() const = 0; virtual const char *fileName() const = 0;
virtual void getJSON(rapidjson::Document &doc) const = 0; virtual void getJSON(rapidjson::Document &doc) const = 0;
virtual void parseJSON(const rapidjson::Document &doc) = 0; virtual void parseJSON(const rapidjson::Document &doc) = 0;