mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-22 10:45:06 +00:00
Merge branch 'evo' into beta
This commit is contained in:
commit
e28c3db019
14 changed files with 76 additions and 44 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,3 +1,8 @@
|
|||
# v2.15.4-beta
|
||||
- Added global uptime and extended connection information in API.
|
||||
- API now return current algorithm instead of global algorithm specified in config.
|
||||
- This version also include all changes from stable version v2.14.4.
|
||||
|
||||
# v2.15.3-beta
|
||||
- [#1014](https://github.com/xmrig/xmrig/issues/1014) Fixed regression, default value for `algo` option was not applied.
|
||||
|
||||
|
@ -16,6 +21,13 @@
|
|||
- Added new option `donate-over-proxy`.
|
||||
- Added real graceful exit.
|
||||
|
||||
# v2.14.4
|
||||
- [#992](https://github.com/xmrig/xmrig/pull/992) Fixed compilation with Clang 3.5.
|
||||
- [#1012](https://github.com/xmrig/xmrig/pull/1012) Fixed compilation with Clang 9.0.
|
||||
- In HTTP API for unknown hashrate now used `null` instead of `0.0`.
|
||||
- Fixed MSVC 2019 version detection.
|
||||
- Removed obsolete automatic variants.
|
||||
|
||||
# v2.14.1
|
||||
* [#975](https://github.com/xmrig/xmrig/issues/975) Fixed crash on Linux if double thread mode used.
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Originally based on cpuminer-multi with heavy optimizations/rewrites and removin
|
|||
* This is the **CPU-mining** version, there is also a [NVIDIA GPU version](https://github.com/xmrig/xmrig-nvidia) and [AMD GPU version]( https://github.com/xmrig/xmrig-amd).
|
||||
* [Roadmap](https://github.com/xmrig/xmrig/issues/106) for next releases.
|
||||
|
||||
<img src="http://i.imgur.com/OKZRVDh.png" width="619" >
|
||||
<img src="http://i.imgur.com/Ymumes5.png" width="670" >
|
||||
|
||||
#### Table of contents
|
||||
* [Features](#features)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "api/v1/ApiRouter.h"
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "common/crypto/keccak.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
|
@ -53,7 +54,8 @@ xmrig::Api::Api(Base *base) :
|
|||
m_base(base),
|
||||
m_id(),
|
||||
m_workerId(),
|
||||
m_httpd(nullptr)
|
||||
m_httpd(nullptr),
|
||||
m_timestamp(Chrono::steadyMSecs())
|
||||
{
|
||||
base->addListener(this);
|
||||
|
||||
|
@ -118,9 +120,12 @@ void xmrig::Api::exec(IApiRequest &request)
|
|||
using namespace rapidjson;
|
||||
|
||||
if (request.method() == IApiRequest::METHOD_GET && (request.url() == "/1/summary" || request.url() == "/api.json")) {
|
||||
auto &allocator = request.doc().GetAllocator();
|
||||
|
||||
request.accept();
|
||||
request.reply().AddMember("id", StringRef(m_id), request.doc().GetAllocator());
|
||||
request.reply().AddMember("worker_id", StringRef(m_workerId), request.doc().GetAllocator());;
|
||||
request.reply().AddMember("id", StringRef(m_id), allocator);
|
||||
request.reply().AddMember("worker_id", StringRef(m_workerId), allocator);
|
||||
request.reply().AddMember("uptime", (Chrono::steadyMSecs() - m_timestamp) / 1000, allocator);
|
||||
}
|
||||
|
||||
for (IApiListener *listener : m_listeners) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
|
@ -72,6 +73,7 @@ private:
|
|||
char m_workerId[128];
|
||||
Httpd *m_httpd;
|
||||
std::vector<IApiListener *> m_listeners;
|
||||
uint64_t m_timestamp;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,13 +40,15 @@
|
|||
#include "workers/Workers.h"
|
||||
|
||||
|
||||
static inline double normalize(double d)
|
||||
static inline rapidjson::Value normalize(double d)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
if (!isnormal(d)) {
|
||||
return 0.0;
|
||||
return Value(kNullType);
|
||||
}
|
||||
|
||||
return floor(d * 100.0) / 100.0;
|
||||
return Value(floor(d * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,7 +144,6 @@ void xmrig::ApiRouter::getMiner(rapidjson::Value &reply, rapidjson::Document &do
|
|||
reply.AddMember("kind", APP_KIND, allocator);
|
||||
reply.AddMember("ua", StringRef(Platform::userAgent()), allocator);
|
||||
reply.AddMember("cpu", cpu, allocator);
|
||||
reply.AddMember("algo", StringRef(m_base->config()->algorithm().shortName()), allocator);
|
||||
reply.AddMember("hugepages", Workers::hugePages() > 0, allocator);
|
||||
reply.AddMember("donate_level", m_base->config()->pools().donateLevel(), allocator);
|
||||
}
|
||||
|
|
|
@ -102,24 +102,6 @@ bool xmrig::Job::setBlob(const char *blob)
|
|||
m_algorithm.setVariant(variant());
|
||||
}
|
||||
|
||||
if (!m_algorithm.isForced()) {
|
||||
if (m_algorithm.variant() == VARIANT_XTL && m_blob[0] >= 9) {
|
||||
m_algorithm.setVariant(VARIANT_HALF);
|
||||
}
|
||||
else if (m_algorithm.variant() == VARIANT_MSR && m_blob[0] >= 8) {
|
||||
m_algorithm.setVariant(VARIANT_HALF);
|
||||
}
|
||||
else if (m_algorithm.variant() == VARIANT_WOW && m_blob[0] < 11) {
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
}
|
||||
else if (m_algorithm.variant() == VARIANT_RWZ && m_blob[0] < 12) {
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
}
|
||||
else if (m_algorithm.variant() == VARIANT_ZLS && m_blob[0] < 8) {
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
memset(m_rawBlob, 0, sizeof(m_rawBlob));
|
||||
memcpy(m_rawBlob, blob, m_size * 2);
|
||||
|
|
|
@ -89,7 +89,7 @@ void xmrig::FailoverStrategy::add(const Pool &pool)
|
|||
|
||||
int64_t xmrig::FailoverStrategy::submit(const JobResult &result)
|
||||
{
|
||||
if (m_active == -1) {
|
||||
if (!isActive()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
protected:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
inline IClient *client() const override { return active(); }
|
||||
inline IClient *client() const override { return isActive() ? active() : m_pools[m_index]; }
|
||||
inline void onLogin(IClient *, rapidjson::Document &, rapidjson::Value &) override {}
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
inline String &operator=(char *str) { move(str); return *this; }
|
||||
inline String &operator=(const char *str) { copy(str); return *this; }
|
||||
inline String &operator=(const String &str) { copy(str); return *this; }
|
||||
inline String &operator=(std::nullptr_t) { delete [] m_data; m_data = nullptr; m_size = 0; return *this; }
|
||||
inline String &operator=(String &&other) { move(std::move(other)); return *this; }
|
||||
|
||||
rapidjson::Value toJSON() const;
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
|
||||
xmrig::Network::Network(Controller *controller) :
|
||||
m_controller(controller),
|
||||
m_donate(nullptr),
|
||||
m_timer(nullptr)
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
|
|||
return;
|
||||
}
|
||||
|
||||
m_state.setPool(client->pool().host(), client->pool().port(), client->ip());
|
||||
m_state.onActive(client);
|
||||
|
||||
const char *tlsVersion = client->tlsVersion();
|
||||
LOG_INFO(WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
|
@ -230,12 +231,18 @@ void xmrig::Network::getConnection(rapidjson::Value &reply, rapidjson::Document
|
|||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
const Algorithm &algo = m_strategy->client()->job().algorithm();
|
||||
reply.AddMember("algo", StringRef((algo.isValid() ? algo : m_controller->config()->algorithm()).shortName()), allocator);
|
||||
|
||||
Value connection(kObjectType);
|
||||
connection.AddMember("pool", StringRef(m_state.pool), allocator);
|
||||
connection.AddMember("uptime", m_state.connectionTime(), allocator);
|
||||
connection.AddMember("ping", m_state.latency(), allocator);
|
||||
connection.AddMember("failures", m_state.failures, allocator);
|
||||
connection.AddMember("error_log", Value(kArrayType), allocator);
|
||||
connection.AddMember("pool", StringRef(m_state.pool), allocator);
|
||||
connection.AddMember("ip", m_state.ip().toJSON(), allocator);
|
||||
connection.AddMember("uptime", m_state.connectionTime(), allocator);
|
||||
connection.AddMember("ping", m_state.latency(), allocator);
|
||||
connection.AddMember("failures", m_state.failures, allocator);
|
||||
connection.AddMember("tls", m_state.tls().toJSON(), allocator);
|
||||
connection.AddMember("tls-fingerprint", m_state.fingerprint().toJSON(), allocator);
|
||||
connection.AddMember("error_log", Value(kArrayType), allocator);
|
||||
|
||||
reply.AddMember("connection", connection, allocator);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
void getResults(rapidjson::Value &reply, rapidjson::Document &doc) const;
|
||||
# endif
|
||||
|
||||
Controller *m_controller;
|
||||
IStrategy *m_donate;
|
||||
IStrategy *m_strategy;
|
||||
NetworkState m_state;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#include "base/kernel/interfaces/IClient.h"
|
||||
#include "base/net/stratum/Pool.h"
|
||||
#include "base/net/stratum/SubmitResult.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "net/NetworkState.h"
|
||||
|
@ -92,23 +94,29 @@ void xmrig::NetworkState::add(const SubmitResult &result, const char *error)
|
|||
std::sort(topDiff.rbegin(), topDiff.rend());
|
||||
}
|
||||
|
||||
m_latency.push_back(result.elapsed > 0xFFFF ? 0xFFFF : (uint16_t) result.elapsed);
|
||||
m_latency.push_back(result.elapsed > 0xFFFF ? 0xFFFF : static_cast<uint16_t>(result.elapsed));
|
||||
}
|
||||
|
||||
|
||||
void xmrig::NetworkState::setPool(const char *host, int port, const char *ip)
|
||||
void xmrig::NetworkState::onActive(IClient *client)
|
||||
{
|
||||
snprintf(pool, sizeof(pool) - 1, "%s:%d", host, port);
|
||||
snprintf(pool, sizeof(pool) - 1, "%s:%d", client->pool().host().data(), client->pool().port());
|
||||
|
||||
m_active = true;
|
||||
m_ip = client->ip();
|
||||
m_tls = client->tlsVersion();
|
||||
m_fingerprint = client->tlsFingerprint();
|
||||
m_active = true;
|
||||
m_connectionTime = Chrono::steadyMSecs();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::NetworkState::stop()
|
||||
{
|
||||
m_active = false;
|
||||
diff = 0;
|
||||
m_active = false;
|
||||
diff = 0;
|
||||
m_ip = nullptr;
|
||||
m_tls = nullptr;
|
||||
m_fingerprint = nullptr;
|
||||
|
||||
failures++;
|
||||
m_latency.clear();
|
||||
|
|
|
@ -30,9 +30,13 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class IClient;
|
||||
class SubmitResult;
|
||||
|
||||
|
||||
|
@ -41,11 +45,15 @@ class NetworkState
|
|||
public:
|
||||
NetworkState();
|
||||
|
||||
inline const String &fingerprint() const { return m_fingerprint; }
|
||||
inline const String &ip() const { return m_ip; }
|
||||
inline const String &tls() const { return m_tls; }
|
||||
|
||||
uint32_t avgTime() const;
|
||||
uint32_t latency() const;
|
||||
uint64_t connectionTime() const;
|
||||
void add(const SubmitResult &result, const char *error);
|
||||
void setPool(const char *host, int port, const char *ip);
|
||||
void onActive(IClient *client);
|
||||
void stop();
|
||||
|
||||
char pool[256];
|
||||
|
@ -59,6 +67,9 @@ public:
|
|||
private:
|
||||
bool m_active;
|
||||
std::vector<uint16_t> m_latency;
|
||||
String m_fingerprint;
|
||||
String m_ip;
|
||||
String m_tls;
|
||||
uint64_t m_connectionTime;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig CPU miner"
|
||||
#define APP_VERSION "2.15.3-beta"
|
||||
#define APP_VERSION "2.15.4-evo"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||
|
@ -36,10 +36,12 @@
|
|||
|
||||
#define APP_VER_MAJOR 2
|
||||
#define APP_VER_MINOR 15
|
||||
#define APP_VER_PATCH 3
|
||||
#define APP_VER_PATCH 4
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1910)
|
||||
# if (_MSC_VER >= 1920)
|
||||
# define MSVC_VERSION 2019
|
||||
# elif (_MSC_VER >= 1910 && _MSC_VER < 1920)
|
||||
# define MSVC_VERSION 2017
|
||||
# elif _MSC_VER == 1900
|
||||
# define MSVC_VERSION 2015
|
||||
|
|
Loading…
Reference in a new issue