Added --token command line option.

This commit is contained in:
XMRig 2020-11-10 21:29:13 +07:00
parent 95d3293f4b
commit f08887180d
No known key found for this signature in database
GPG key ID: 446A53638BE94409
7 changed files with 13 additions and 3 deletions

View file

@ -54,6 +54,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
if (!m_benchmark->id().isEmpty()) {
m_job.setId(m_benchmark->id());
m_job.setBenchToken(m_benchmark->token());
m_mode = ONLINE_VERIFY;
return;

View file

@ -57,6 +57,7 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
m_submit(Json::getBool(object, kSubmit)),
m_id(id),
m_seed(Json::getString(object, kSeed)),
m_token(Json::getString(object, kToken)),
m_size(size),
m_hash(0)
{
@ -91,12 +92,12 @@ xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
{
if (!benchmark) {
return false;
return 0;
}
const auto size = strtoul(benchmark, nullptr, 10);
if (size < 1 || size > 10) {
return false;
return 0;
}
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;

View file

@ -57,6 +57,7 @@ public:
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const String &id() const { return m_id; }
inline const String &seed() const { return m_seed; }
inline const String &token() const { return m_token; }
inline uint32_t size() const { return m_size; }
inline uint64_t hash() const { return m_hash; }
@ -67,6 +68,7 @@ private:
bool m_submit;
String m_id;
String m_seed;
String m_token;
uint32_t m_size;
uint64_t m_hash;
};