Compare commits

..

8 Commits

Author SHA1 Message Date
XMRig
6e839d2c92 Use fake algorithm for test. 2019-08-09 15:08:39 +07:00
XMRig
57ebee8ea7 v2.99.1-beta 2019-08-09 14:21:02 +07:00
XMRig
13a44dda16 Sync changes with miner. 2019-08-09 14:01:43 +07:00
XMRig
e661835b83 v2.99.0-beta 2019-08-04 18:22:30 +07:00
XMRig
704ffd4b26 Merge branch 'evo' into beta 2019-08-04 18:19:08 +07:00
xmrig
8564da0b18 Update CHANGELOG.md 2019-08-04 15:53:51 +07:00
XMRig
216c33a633 v2.99.0-evo 2019-08-03 23:34:53 +07:00
XMRig
90261ac1d2 Merge branch 'v2_99' into evo 2019-08-03 23:21:40 +07:00
10 changed files with 88 additions and 10 deletions

View File

@@ -1,3 +1,14 @@
# v2.99.1-beta
- [#1066](https://github.com/xmrig/xmrig/issues/1066#issuecomment-518080529) Added error message if pool not ready for RandomX.
- Name for reference RandomX configuration changed to `rx/text` to avoid potential conflicts in future.
# v2.99.0-beta
* [#335](https://github.com/xmrig/xmrig-proxy/issues/335) Added support for unlimited algorithm switching.
* Config files from previous versions NOT compatible, `variant` option replaced to `algo`, global option `algo` removed.
* Command line options also not compatible, `--variant` option replaced to `--algo`.
* Algorithm `cn/msr` renamed to `cn/fast`.
* Algorithm `cn/xtl` removed.
# v2.16.1-beta
- Added RandomXL algorithm for [Loki](https://loki.network/).
- Algorithm name used by proxy is `randomx/loki` or `rx/loki`.

View File

@@ -56,6 +56,8 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
rapidjson::OStreamWrapper osw(ofs);
rapidjson::PrettyWriter<rapidjson::OStreamWrapper> writer(osw);
writer.SetFormatOptions(rapidjson::kFormatSingleLineArray);
doc.Accept(writer);
return true;

View File

@@ -118,6 +118,8 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
OStreamWrapper osw(ofs);
PrettyWriter<OStreamWrapper> writer(osw);
writer.SetFormatOptions(kFormatSingleLineArray);
doc.Accept(writer);
return true;

View File

@@ -57,6 +57,14 @@
#endif
namespace xmrig {
static const char *kConfigPathV1 = "/1/config";
static const char *kConfigPathV2 = "/2/config";
} // namespace xmrig
class xmrig::BasePrivate
{
public:
@@ -296,7 +304,7 @@ void xmrig::Base::onFileChanged(const String &fileName)
void xmrig::Base::onRequest(IApiRequest &request)
{
if (request.method() == IApiRequest::METHOD_GET) {
if (request.url() == "/1/config") {
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
if (request.isRestricted()) {
return request.done(403);
}
@@ -306,7 +314,7 @@ void xmrig::Base::onRequest(IApiRequest &request)
}
}
else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) {
if (request.url() == "/1/config") {
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
request.accept();
if (!reload(request.json())) {

View File

@@ -80,6 +80,8 @@ void xmrig::HttpApiResponse::end()
StringBuffer buffer(nullptr, 4096);
PrettyWriter<StringBuffer> writer(buffer);
writer.SetMaxDecimalPlaces(10);
writer.SetFormatOptions(kFormatSingleLineArray);
m_doc.Accept(writer);
HttpResponse::end(buffer.GetString(), buffer.GetSize());

View File

@@ -335,13 +335,19 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
job.setAlgorithm(algo);
}
job.setSeedHash(Json::getString(params, "seed_hash"));
job.setHeight(Json::getUint64(params, "height"));
if (!verifyAlgorithm(job.algorithm(), algo)) {
*code = 6;
return false;
}
close();
if (job.algorithm().family() == Algorithm::RANDOM_X && !job.setSeedHash(Json::getString(params, "seed_hash"))) {
if (!isQuiet()) {
LOG_ERR("[%s] failed to parse field \"seed_hash\" required by RandomX", url(), algo);
}
*code = 7;
return false;
}
@@ -693,6 +699,9 @@ void xmrig::Client::parseNotification(const char *method, const rapidjson::Value
if (parseJob(params, &code)) {
m_listener->onJobReceived(this, m_job, params);
}
else {
close();
}
return;
}

View File

@@ -107,6 +107,8 @@ static AlgoName const algorithm_names[] = {
{ "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 },
# endif
# ifdef XMRIG_ALGO_RANDOMX
{ "randomx/test", "rx/test", Algorithm::RX_0 },
{ "randomx/0", "rx/0", Algorithm::RX_0 },
{ "randomx/0", "rx/0", Algorithm::RX_0 },
{ "RandomX", "rx", Algorithm::RX_0 },
{ "randomx/wow", "rx/wow", Algorithm::RX_WOW },
@@ -120,6 +122,24 @@ static AlgoName const algorithm_names[] = {
} /* namespace xmrig */
int xmrig::Algorithm::maxIntensity() const
{
# ifdef XMRIG_ALGO_RANDOMX
if (family() == RANDOM_X) {
return 1;
}
# endif
# ifdef XMRIG_ALGO_CN_GPU
if (m_id == CN_GPU) {
return 1;
}
# endif
return 5;
}
rapidjson::Value xmrig::Algorithm::toJSON() const
{
using namespace rapidjson;
@@ -128,7 +148,27 @@ rapidjson::Value xmrig::Algorithm::toJSON() const
}
size_t xmrig::Algorithm::memory() const
size_t xmrig::Algorithm::l2() const
{
# ifdef XMRIG_ALGO_RANDOMX
switch (m_id) {
case RX_0:
case RX_LOKI:
return 0x40000;
case RX_WOW:
return 0x20000;
default:
break;
}
# endif
return 0;
}
size_t xmrig::Algorithm::l3() const
{
const Family f = family();
assert(f != UNKNOWN);

View File

@@ -102,8 +102,10 @@ public:
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
inline operator Algorithm::Id() const { return m_id; }
int maxIntensity() const;
rapidjson::Value toJSON() const;
size_t memory() const;
size_t l2() const;
size_t l3() const;
static Family family(Id id);
static Id parse(const char *name);

View File

@@ -178,7 +178,9 @@ void xmrig::Miner::setJob(Job &job)
customDiff = true;
}
sendJob(job.rawBlob(), job.id().data(), customDiff ? m_sendBuf : job.rawTarget(), job.algorithm().shortName(), job.height(), job.rawSeedHash());
Algorithm algo(Algorithm::RX_0);
sendJob(job.rawBlob(), job.id().data(), customDiff ? m_sendBuf : job.rawTarget(), algo.shortName(), job.height(), job.rawSeedHash());
}
@@ -252,7 +254,7 @@ bool xmrig::Miner::parseRequest(int64_t id, const char *method, const rapidjson:
event->reject(Error::InvalidNonce);
}
if (event->error() == Error::NoError && m_customDiff && event->request.actualDiff() < m_diff) {
if (event->error() == Error::NoError) {
success(id, "OK");
return true;
}

View File

@@ -28,14 +28,14 @@
#define APP_ID "xmrig-proxy"
#define APP_NAME "xmrig-proxy"
#define APP_DESC "XMRig Stratum proxy"
#define APP_VERSION "2.16.1-beta"
#define APP_VERSION "2.99.1-beta"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
#define APP_KIND "proxy"
#define APP_VER_MAJOR 2
#define APP_VER_MINOR 16
#define APP_VER_MINOR 99
#define APP_VER_PATCH 1
#ifdef _MSC_VER