mirror of
https://github.com/xmrig/xmrig.git
synced 2026-01-18 05:19:30 -05:00
Merge branch 'dev' into feature/yadacoin
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,6 +1,20 @@
|
|||||||
# v6.17.0
|
# v6.17.0
|
||||||
- [#2411](https://github.com/xmrig/xmrig/pull/2411) Added support for Yada (`rx/yada` algorithm).
|
- [#2411](https://github.com/xmrig/xmrig/pull/2411) Added support for Yada (`rx/yada` algorithm).
|
||||||
|
|
||||||
|
|
||||||
|
# v6.16.3
|
||||||
|
- [#2778](https://github.com/xmrig/xmrig/pull/2778) Fixed `READY threads X/X` display after algorithm switching.
|
||||||
|
- [#2782](https://github.com/xmrig/xmrig/pull/2782) Updated GhostRider documentation.
|
||||||
|
- [#2815](https://github.com/xmrig/xmrig/pull/2815) Fixed `cn-heavy` in 32-bit builds.
|
||||||
|
- [#2827](https://github.com/xmrig/xmrig/pull/2827) GhostRider: set correct priority for helper threads.
|
||||||
|
- [#2837](https://github.com/xmrig/xmrig/pull/2837) RandomX: don't restart mining threads when the seed changes.
|
||||||
|
- [#2848](https://github.com/xmrig/xmrig/pull/2848) GhostRider: added support for `client.reconnect` method.
|
||||||
|
- [#2856](https://github.com/xmrig/xmrig/pull/2856) Fix for short responses from some Raptoreum pools.
|
||||||
|
- [#2873](https://github.com/xmrig/xmrig/pull/2873) Fixed GhostRider benchmark on single-core systems.
|
||||||
|
- [#2882](https://github.com/xmrig/xmrig/pull/2882) Fixed ARMv7 compilation.
|
||||||
|
- [#2893](https://github.com/xmrig/xmrig/pull/2893) KawPow OpenCL: use separate UV loop for building programs.
|
||||||
|
|
||||||
|
|
||||||
# v6.16.2
|
# v6.16.2
|
||||||
- [#2751](https://github.com/xmrig/xmrig/pull/2751) Fixed crash on CPUs supporting VAES and running GCC-compiled xmrig.
|
- [#2751](https://github.com/xmrig/xmrig/pull/2751) Fixed crash on CPUs supporting VAES and running GCC-compiled xmrig.
|
||||||
- [#2761](https://github.com/xmrig/xmrig/pull/2761) Fixed broken auto-tuning in GCC Windows build.
|
- [#2761](https://github.com/xmrig/xmrig/pull/2761) Fixed broken auto-tuning in GCC Windows build.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
[](https://github.com/xmrig/xmrig/stargazers)
|
[](https://github.com/xmrig/xmrig/stargazers)
|
||||||
[](https://github.com/xmrig/xmrig/network)
|
[](https://github.com/xmrig/xmrig/network)
|
||||||
|
|
||||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight, AstroBWT and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
||||||
|
|
||||||
## Mining backends
|
## Mining backends
|
||||||
- **CPU** (x64/ARMv8)
|
- **CPU** (x64/ARMv8)
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS} -flax-vector-conversions")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS} -flax-vector-conversions")
|
||||||
elseif (ARM_TARGET EQUAL 7)
|
elseif (ARM_TARGET EQUAL 7)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -flax-vector-conversions")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||||
|
|||||||
@@ -16,5 +16,8 @@
|
|||||||
:: Smaller pools also often have smaller fees/payout limits.
|
:: Smaller pools also often have smaller fees/payout limits.
|
||||||
|
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
|
:: Use this command line to connect to non-SSL port
|
||||||
xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
|
xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
|
||||||
|
:: Or use this command line to connect to an SSL port
|
||||||
|
:: xmrig.exe -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "base/net/stratum/Job.h"
|
#include "base/net/stratum/Job.h"
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "crypto/common/Nonce.h"
|
#include "crypto/common/Nonce.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ public:
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
*nonce(i) += roundSize;
|
writeUnaligned(nonce(i), readUnaligned(nonce(i)) + roundSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,11 +137,11 @@ inline bool xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nonceSize() == sizeof(uint64_t)) {
|
if (nonceSize() == sizeof(uint64_t)) {
|
||||||
m_jobs[index()].nonce()[1] = n[1];
|
writeUnaligned(m_jobs[index()].nonce() + 1, readUnaligned(n + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*n += roundSize;
|
writeUnaligned(n, readUnaligned(n) + roundSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -76,12 +76,13 @@ public:
|
|||||||
{
|
{
|
||||||
m_workersMemory.clear();
|
m_workersMemory.clear();
|
||||||
m_hugePages.reset();
|
m_hugePages.reset();
|
||||||
m_memory = memory;
|
m_memory = memory;
|
||||||
m_started = 0;
|
m_started = 0;
|
||||||
m_errors = 0;
|
m_totalStarted = 0;
|
||||||
m_threads = threads.size();
|
m_errors = 0;
|
||||||
m_ways = 0;
|
m_threads = threads.size();
|
||||||
m_ts = Chrono::steadyMSecs();
|
m_ways = 0;
|
||||||
|
m_ts = Chrono::steadyMSecs();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool started(IWorker *worker, bool ready)
|
inline bool started(IWorker *worker, bool ready)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "backend/cpu/Cpu.h"
|
#include "backend/cpu/Cpu.h"
|
||||||
#include "backend/cpu/CpuWorker.h"
|
#include "backend/cpu/CpuWorker.h"
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Miner.h"
|
#include "core/Miner.h"
|
||||||
@@ -100,7 +101,7 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
m_ghHelper = ghostrider::create_helper_thread(affinity(), data.affinities);
|
m_ghHelper = ghostrider::create_helper_thread(affinity(), data.priority, data.affinities);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ void xmrig::CpuWorker<N>::allocateRandomX_VM()
|
|||||||
RxDataset *dataset = Rx::dataset(m_job.currentJob(), node());
|
RxDataset *dataset = Rx::dataset(m_job.currentJob(), node());
|
||||||
|
|
||||||
while (dataset == nullptr) {
|
while (dataset == nullptr) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
|
|
||||||
if (Nonce::sequence(Nonce::CPU) == 0) {
|
if (Nonce::sequence(Nonce::CPU) == 0) {
|
||||||
return;
|
return;
|
||||||
@@ -246,7 +247,7 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
while (Nonce::sequence(Nonce::CPU) > 0) {
|
while (Nonce::sequence(Nonce::CPU) > 0) {
|
||||||
if (Nonce::isPaused()) {
|
if (Nonce::isPaused()) {
|
||||||
do {
|
do {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
}
|
}
|
||||||
while (Nonce::isPaused() && Nonce::sequence(Nonce::CPU) > 0);
|
while (Nonce::isPaused() && Nonce::sequence(Nonce::CPU) > 0);
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
|
|
||||||
uint32_t current_job_nonces[N];
|
uint32_t current_job_nonces[N];
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
current_job_nonces[i] = *m_job.nonce(i);
|
current_job_nonces[i] = readUnaligned(m_job.nonce(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "backend/cuda/runners/CudaCnRunner.h"
|
#include "backend/cuda/runners/CudaCnRunner.h"
|
||||||
#include "backend/cuda/wrappers/CudaDevice.h"
|
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "core/Miner.h"
|
#include "core/Miner.h"
|
||||||
#include "crypto/common/Nonce.h"
|
#include "crypto/common/Nonce.h"
|
||||||
@@ -152,7 +153,7 @@ void xmrig::CudaWorker::start()
|
|||||||
uint32_t foundNonce[16] = { 0 };
|
uint32_t foundNonce[16] = { 0 };
|
||||||
uint32_t foundCount = 0;
|
uint32_t foundCount = 0;
|
||||||
|
|
||||||
if (!m_runner->run(*m_job.nonce(), &foundCount, foundNonce)) {
|
if (!m_runner->run(readUnaligned(m_job.nonce()), &foundCount, foundNonce)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "backend/opencl/runners/tools/OclSharedData.h"
|
#include "backend/opencl/runners/tools/OclSharedData.h"
|
||||||
#include "backend/opencl/runners/tools/OclSharedState.h"
|
#include "backend/opencl/runners/tools/OclSharedState.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "core/Miner.h"
|
#include "core/Miner.h"
|
||||||
#include "crypto/common/Nonce.h"
|
#include "crypto/common/Nonce.h"
|
||||||
@@ -179,7 +180,7 @@ void xmrig::OclWorker::start()
|
|||||||
const uint64_t t = Chrono::steadyMSecs();
|
const uint64_t t = Chrono::steadyMSecs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_runner->run(*m_job.nonce(), results);
|
m_runner->run(readUnaligned(m_job.nonce()), results);
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
catch (std::exception &ex) {
|
||||||
printError(id(), ex.what());
|
printError(id(), ex.what());
|
||||||
|
|||||||
@@ -153,9 +153,35 @@ static KawPowCache cache;
|
|||||||
#define mix_dst() ("mix[" + std::to_string(mix_seq_dst[(mix_seq_dst_cnt++) % KPHash::REGS]) + "]")
|
#define mix_dst() ("mix[" + std::to_string(mix_seq_dst[(mix_seq_dst_cnt++) % KPHash::REGS]) + "]")
|
||||||
#define mix_cache() ("mix[" + std::to_string(mix_seq_cache[(mix_seq_cache_cnt++) % KPHash::REGS]) + "]")
|
#define mix_cache() ("mix[" + std::to_string(mix_seq_cache[(mix_seq_cache_cnt++) % KPHash::REGS]) + "]")
|
||||||
|
|
||||||
|
class KawPowBaton : public Baton<uv_work_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline KawPowBaton(const IOclRunner& runner, uint64_t period, uint32_t worksize) :
|
||||||
|
runner(runner),
|
||||||
|
period(period),
|
||||||
|
worksize(worksize)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const IOclRunner& runner;
|
||||||
|
const uint64_t period;
|
||||||
|
const uint32_t worksize;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class KawPowBuilder
|
class KawPowBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~KawPowBuilder()
|
||||||
|
{
|
||||||
|
if (m_loop) {
|
||||||
|
uv_async_send(&m_shutdownAsync);
|
||||||
|
uv_thread_join(&m_loopThread);
|
||||||
|
delete m_loop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void build_async(const IOclRunner& runner, uint64_t period, uint32_t worksize);
|
||||||
|
|
||||||
cl_kernel build(const IOclRunner &runner, uint64_t period, uint32_t worksize)
|
cl_kernel build(const IOclRunner &runner, uint64_t period, uint32_t worksize)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
@@ -368,40 +394,54 @@ private:
|
|||||||
st.jcong = 69069 * st.jcong + 1234567;
|
st.jcong = 69069 * st.jcong + 1234567;
|
||||||
return ((MWC ^ st.jcong) + st.jsr);
|
return ((MWC ^ st.jcong) + st.jsr);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
uv_loop_t* m_loop = nullptr;
|
||||||
|
uv_thread_t m_loopThread = {};
|
||||||
|
uv_async_t m_shutdownAsync = {};
|
||||||
|
|
||||||
class KawPowBaton : public Baton<uv_work_t>
|
static void loop(void* data)
|
||||||
{
|
{
|
||||||
public:
|
KawPowBuilder* builder = static_cast<KawPowBuilder*>(data);
|
||||||
inline KawPowBaton(const IOclRunner &runner, uint64_t period, uint32_t worksize) :
|
uv_run(builder->m_loop, UV_RUN_DEFAULT);
|
||||||
runner(runner),
|
uv_loop_close(builder->m_loop);
|
||||||
period(period),
|
}
|
||||||
worksize(worksize)
|
|
||||||
{}
|
|
||||||
|
|
||||||
const IOclRunner &runner;
|
|
||||||
const uint64_t period;
|
|
||||||
const uint32_t worksize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static KawPowBuilder builder;
|
static KawPowBuilder builder;
|
||||||
|
|
||||||
|
|
||||||
|
void KawPowBuilder::build_async(const IOclRunner& runner, uint64_t period, uint32_t worksize)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
if (!m_loop) {
|
||||||
|
m_loop = new uv_loop_t{};
|
||||||
|
uv_loop_init(m_loop);
|
||||||
|
uv_async_init(m_loop, &m_shutdownAsync, [](uv_async_t* handle) { uv_close(reinterpret_cast<uv_handle_t*>(handle), nullptr); });
|
||||||
|
uv_thread_create(&m_loopThread, loop, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
KawPowBaton* baton = new KawPowBaton(runner, period, worksize);
|
||||||
|
|
||||||
|
uv_queue_work(m_loop, &baton->req,
|
||||||
|
[](uv_work_t* req) {
|
||||||
|
KawPowBaton* baton = static_cast<KawPowBaton*>(req->data);
|
||||||
|
builder.build(baton->runner, baton->period, baton->worksize);
|
||||||
|
},
|
||||||
|
[](uv_work_t* req, int) { delete static_cast<KawPowBaton*>(req->data); }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cl_kernel OclKawPow::get(const IOclRunner &runner, uint64_t height, uint32_t worksize)
|
cl_kernel OclKawPow::get(const IOclRunner &runner, uint64_t height, uint32_t worksize)
|
||||||
{
|
{
|
||||||
const uint64_t period = height / KPHash::PERIOD_LENGTH;
|
const uint64_t period = height / KPHash::PERIOD_LENGTH;
|
||||||
|
|
||||||
KawPowBaton* baton = new KawPowBaton(runner, period + 1, worksize);
|
if (!cache.search(runner, period + 1, worksize)) {
|
||||||
|
builder.build_async(runner, period + 1, worksize);
|
||||||
uv_queue_work(uv_default_loop(), &baton->req,
|
}
|
||||||
[](uv_work_t *req) {
|
|
||||||
KawPowBaton* baton = static_cast<KawPowBaton*>(req->data);
|
|
||||||
builder.build(baton->runner, baton->period, baton->worksize);
|
|
||||||
},
|
|
||||||
[](uv_work_t *req, int) { delete static_cast<KawPowBaton*>(req->data); }
|
|
||||||
);
|
|
||||||
|
|
||||||
cl_kernel kernel = cache.search(runner, period, worksize);
|
cl_kernel kernel = cache.search(runner, period, worksize);
|
||||||
if (kernel) {
|
if (kernel) {
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ set(HEADERS_BASE
|
|||||||
src/base/net/tools/MemPool.h
|
src/base/net/tools/MemPool.h
|
||||||
src/base/net/tools/NetBuffer.h
|
src/base/net/tools/NetBuffer.h
|
||||||
src/base/net/tools/Storage.h
|
src/base/net/tools/Storage.h
|
||||||
|
src/base/tools/Alignment.h
|
||||||
src/base/tools/Arguments.h
|
src/base/tools/Arguments.h
|
||||||
src/base/tools/Baton.h
|
src/base/tools/Baton.h
|
||||||
src/base/tools/bswap_64.h
|
src/base/tools/bswap_64.h
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
#ifdef XMRIG_FEATURE_TLS
|
#ifdef XMRIG_FEATURE_TLS
|
||||||
@@ -660,7 +661,7 @@ void xmrig::Client::parse(char *line, size_t len)
|
|||||||
|
|
||||||
LOG_DEBUG("[%s] received (%d bytes): \"%.*s\"", url(), len, static_cast<int>(len), line);
|
LOG_DEBUG("[%s] received (%d bytes): \"%.*s\"", url(), len, static_cast<int>(len), line);
|
||||||
|
|
||||||
if (len < 32 || line[0] != '{') {
|
if (len < 22 || line[0] != '{') {
|
||||||
if (!isQuiet()) {
|
if (!isQuiet()) {
|
||||||
LOG_ERR("%s " RED("JSON decode failed"), tag());
|
LOG_ERR("%s " RED("JSON decode failed"), tag());
|
||||||
}
|
}
|
||||||
@@ -683,12 +684,48 @@ void xmrig::Client::parse(char *line, size_t len)
|
|||||||
|
|
||||||
const auto &id = Json::getValue(doc, "id");
|
const auto &id = Json::getValue(doc, "id");
|
||||||
const auto &error = Json::getValue(doc, "error");
|
const auto &error = Json::getValue(doc, "error");
|
||||||
|
const char *method = Json::getString(doc, "method");
|
||||||
|
|
||||||
|
if (method && strcmp(method, "client.reconnect") == 0) {
|
||||||
|
const auto ¶ms = Json::getValue(doc, "params");
|
||||||
|
if (!params.IsArray()) {
|
||||||
|
LOG_ERR("%s " RED("invalid client.reconnect notification: params is not an array"), tag());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto arr = params.GetArray();
|
||||||
|
|
||||||
|
if (arr.Empty()) {
|
||||||
|
LOG_ERR("%s " RED("invalid client.reconnect notification: params array is empty"), tag());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr.Size() != 2) {
|
||||||
|
LOG_ERR("%s " RED("invalid client.reconnect notification: params array has wrong size"), tag());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arr[0].IsString()) {
|
||||||
|
LOG_ERR("%s " RED("invalid client.reconnect notification: host is not a string"), tag());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arr[1].IsString()) {
|
||||||
|
LOG_ERR("%s " RED("invalid client.reconnect notification: port is not a string"), tag());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::stringstream s;
|
||||||
|
s << arr[0].GetString() << ":" << arr[1].GetString();
|
||||||
|
LOG_WARN("%s " YELLOW("client.reconnect to %s"), tag(), s.str().c_str());
|
||||||
|
setPoolUrl(s.str().c_str());
|
||||||
|
return reconnect();
|
||||||
|
}
|
||||||
|
|
||||||
if (id.IsInt64()) {
|
if (id.IsInt64()) {
|
||||||
return parseResponse(id.GetInt64(), Json::getValue(doc, "result"), error);
|
return parseResponse(id.GetInt64(), Json::getValue(doc, "result"), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *method = Json::getString(doc, "method");
|
|
||||||
if (!method) {
|
if (!method) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ protected:
|
|||||||
inline const char *url() const { return m_pool.url(); }
|
inline const char *url() const { return m_pool.url(); }
|
||||||
inline const String &rpcId() const { return m_rpcId; }
|
inline const String &rpcId() const { return m_rpcId; }
|
||||||
inline void setRpcId(const char *id) { m_rpcId = id; }
|
inline void setRpcId(const char *id) { m_rpcId = id; }
|
||||||
|
inline void setPoolUrl(const char *url) { m_pool.setUrl(url); }
|
||||||
|
|
||||||
virtual bool parseLogin(const rapidjson::Value &result, int *code);
|
virtual bool parseLogin(const rapidjson::Value &result, int *code);
|
||||||
virtual void login();
|
virtual void login();
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "base/net/stratum/Job.h"
|
#include "base/net/stratum/Job.h"
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "base/tools/Buffer.h"
|
#include "base/tools/Buffer.h"
|
||||||
#include "base/tools/Cvt.h"
|
#include "base/tools/Cvt.h"
|
||||||
#include "base/tools/cryptonote/BlockTemplate.h"
|
#include "base/tools/cryptonote/BlockTemplate.h"
|
||||||
@@ -73,7 +74,7 @@ bool xmrig::Job::setBlob(const char *blob)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*nonce() != 0 && !m_nicehash) {
|
if (readUnaligned(nonce()) != 0 && !m_nicehash) {
|
||||||
m_nicehash = true;
|
m_nicehash = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
inline int zmq_port() const { return m_zmqPort; }
|
inline int zmq_port() const { return m_zmqPort; }
|
||||||
inline uint64_t pollInterval() const { return m_pollInterval; }
|
inline uint64_t pollInterval() const { return m_pollInterval; }
|
||||||
inline void setAlgo(const Algorithm &algorithm) { m_algorithm = algorithm; }
|
inline void setAlgo(const Algorithm &algorithm) { m_algorithm = algorithm; }
|
||||||
|
inline void setUrl(const char *url) { m_url = Url(url); }
|
||||||
inline void setPassword(const String &password) { m_password = password; }
|
inline void setPassword(const String &password) { m_password = password; }
|
||||||
inline void setProxy(const ProxyUrl &proxy) { m_proxy = proxy; }
|
inline void setProxy(const ProxyUrl &proxy) { m_proxy = proxy; }
|
||||||
inline void setRigId(const String &rigId) { m_rigId = rigId; }
|
inline void setRigId(const String &rigId) { m_rigId = rigId; }
|
||||||
|
|||||||
53
src/base/tools/Alignment.h
Normal file
53
src/base/tools/Alignment.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* XMRig
|
||||||
|
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright (c) 2016-2022 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XMRIG_ALIGNMENT_H
|
||||||
|
#define XMRIG_ALIGNMENT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T readUnaligned(const T* ptr)
|
||||||
|
{
|
||||||
|
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||||
|
|
||||||
|
T result;
|
||||||
|
memcpy(&result, ptr, sizeof(T));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline void writeUnaligned(T* ptr, T data)
|
||||||
|
{
|
||||||
|
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||||
|
|
||||||
|
memcpy(ptr, &data, sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace xmrig */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* XMRIG_ALIGNMENT_H */
|
||||||
@@ -94,6 +94,10 @@
|
|||||||
"ciphersuites": null,
|
"ciphersuites": null,
|
||||||
"dhparam": null
|
"dhparam": null
|
||||||
},
|
},
|
||||||
|
"dns": {
|
||||||
|
"ipv6": false,
|
||||||
|
"ttl": 30
|
||||||
|
},
|
||||||
"user-agent": null,
|
"user-agent": null,
|
||||||
"verbose": 0,
|
"verbose": 0,
|
||||||
"watch": true,
|
"watch": true,
|
||||||
|
|||||||
@@ -553,7 +553,13 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
|
if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
|
||||||
stop();
|
if (d_ptr->algorithm != job.algorithm()) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Nonce::pause(true);
|
||||||
|
Nonce::touch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|||||||
@@ -808,7 +808,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||||||
|
|
||||||
int64_t d5;
|
int64_t d5;
|
||||||
|
|
||||||
# if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 8))
|
# if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 8)) || !defined(XMRIG_64_BIT)
|
||||||
d5 = d | 5;
|
d5 = d | 5;
|
||||||
# else
|
# else
|
||||||
// Workaround for stupid GCC which converts to 32 bit before doing "| 5" and then converts back to 64 bit
|
// Workaround for stupid GCC which converts to 32 bit before doing "| 5" and then converts back to 64 bit
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ typedef union ALIGN_STRUCT(16) SIMDVec {
|
|||||||
|
|
||||||
// Older gcc does not define vld1q_u8_x4 type
|
// Older gcc does not define vld1q_u8_x4 type
|
||||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||||
((__GNUC__ <= 10 && defined(__arm__)) || \
|
((__GNUC__ <= 11 && defined(__arm__)) || \
|
||||||
(__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \
|
(__GNUC__ == 10 && __GNUC_MINOR__ < 3 && defined(__aarch64__)) || \
|
||||||
(__GNUC__ <= 9 && defined(__aarch64__)))
|
(__GNUC__ <= 9 && defined(__aarch64__)))
|
||||||
FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p)
|
FORCE_INLINE uint8x16x4_t _sse2neon_vld1q_u8_x4(const uint8_t *p)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "base/tools/Alignment.h"
|
||||||
#include "crypto/common/Nonce.h"
|
#include "crypto/common/Nonce.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -53,10 +54,10 @@ bool xmrig::Nonce::next(uint8_t index, uint32_t *nonce, uint32_t reserveCount, u
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
*nonce = (nonce[0] & ~mask) | counter;
|
writeUnaligned(nonce, static_cast<uint32_t>((readUnaligned(nonce) & ~mask) | counter));
|
||||||
|
|
||||||
if (mask > 0xFFFFFFFFULL) {
|
if (mask > 0xFFFFFFFFULL) {
|
||||||
nonce[1] = (nonce[1] & (~mask >> 32)) | (counter >> 32);
|
writeUnaligned(nonce + 1, static_cast<uint32_t>((readUnaligned(nonce + 1) & (~mask >> 32)) | (counter >> 32)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ No tuning is required - auto-config works well on most CPUs!
|
|||||||
|
|
||||||
### Sample command line (non-SSL port)
|
### Sample command line (non-SSL port)
|
||||||
```
|
```
|
||||||
xmrig -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS
|
xmrig -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sample command line (SSL port)
|
### Sample command line (SSL port)
|
||||||
```
|
```
|
||||||
xmrig -a gr -o us.flockpool.com:5555 --tls -u WALLET_ADDRESS
|
xmrig -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use **rtm_ghostrider_example.cmd** as a template and put pool URL and your wallet address there. The general XMRig documentation is available [here](https://xmrig.com/docs/miner).
|
You can use **rtm_ghostrider_example.cmd** as a template and put pool URL and your wallet address there. The general XMRig documentation is available [here](https://xmrig.com/docs/miner).
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ static struct AlgoTune
|
|||||||
|
|
||||||
struct HelperThread
|
struct HelperThread
|
||||||
{
|
{
|
||||||
HelperThread(hwloc_bitmap_t cpu_set, bool is8MB) : m_cpuSet(cpu_set), m_is8MB(is8MB)
|
HelperThread(hwloc_bitmap_t cpu_set, int priority, bool is8MB) : m_cpuSet(cpu_set), m_priority(priority), m_is8MB(is8MB)
|
||||||
{
|
{
|
||||||
uv_mutex_init(&m_mutex);
|
uv_mutex_init(&m_mutex);
|
||||||
uv_cond_init(&m_cond);
|
uv_cond_init(&m_cond);
|
||||||
@@ -241,6 +241,8 @@ struct HelperThread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Platform::setThreadPriority(m_priority);
|
||||||
|
|
||||||
uv_mutex_lock(&m_mutex);
|
uv_mutex_lock(&m_mutex);
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
|
|
||||||
@@ -268,6 +270,7 @@ struct HelperThread
|
|||||||
volatile bool m_ready = false;
|
volatile bool m_ready = false;
|
||||||
volatile bool m_finished = false;
|
volatile bool m_finished = false;
|
||||||
hwloc_bitmap_t m_cpuSet = {};
|
hwloc_bitmap_t m_cpuSet = {};
|
||||||
|
int m_priority = -1;
|
||||||
bool m_is8MB = false;
|
bool m_is8MB = false;
|
||||||
|
|
||||||
std::thread* m_thread = nullptr;
|
std::thread* m_thread = nullptr;
|
||||||
@@ -290,13 +293,14 @@ void benchmark()
|
|||||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1);
|
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1);
|
||||||
hwloc_obj_t pu2;
|
hwloc_obj_t pu2;
|
||||||
hwloc_get_closest_objs(topology, pu, &pu2, 1);
|
hwloc_get_closest_objs(topology, pu, &pu2, 1);
|
||||||
uint32_t thread_index2 = pu2->os_index;
|
uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1;
|
||||||
|
|
||||||
if (thread_index2 < thread_index1) {
|
if (thread_index2 < thread_index1) {
|
||||||
std::swap(thread_index1, thread_index2);
|
std::swap(thread_index1, thread_index2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::setThreadAffinity(thread_index1);
|
Platform::setThreadAffinity(thread_index1);
|
||||||
|
Platform::setThreadPriority(3);
|
||||||
|
|
||||||
constexpr uint32_t N = 1U << 21;
|
constexpr uint32_t N = 1U << 21;
|
||||||
|
|
||||||
@@ -375,7 +379,7 @@ void benchmark()
|
|||||||
|
|
||||||
hwloc_bitmap_t helper_set = hwloc_bitmap_alloc();
|
hwloc_bitmap_t helper_set = hwloc_bitmap_alloc();
|
||||||
hwloc_bitmap_set(helper_set, thread_index2);
|
hwloc_bitmap_set(helper_set, thread_index2);
|
||||||
HelperThread* helper = new HelperThread(helper_set, false);
|
HelperThread* helper = new HelperThread(helper_set, 3, false);
|
||||||
|
|
||||||
for (uint32_t algo = 0; algo < 6; ++algo) {
|
for (uint32_t algo = 0; algo < 6; ++algo) {
|
||||||
for (uint64_t step : { 1, 2, 4}) {
|
for (uint64_t step : { 1, 2, 4}) {
|
||||||
@@ -465,7 +469,7 @@ static inline bool findByType(hwloc_obj_t obj, hwloc_obj_type_t type, func lambd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HelperThread* create_helper_thread(int64_t cpu_index, const std::vector<int64_t>& affinities)
|
HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector<int64_t>& affinities)
|
||||||
{
|
{
|
||||||
#ifndef XMRIG_ARM
|
#ifndef XMRIG_ARM
|
||||||
hwloc_bitmap_t helper_cpu_set = hwloc_bitmap_alloc();
|
hwloc_bitmap_t helper_cpu_set = hwloc_bitmap_alloc();
|
||||||
@@ -520,7 +524,7 @@ HelperThread* create_helper_thread(int64_t cpu_index, const std::vector<int64_t>
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (hwloc_bitmap_weight(helper_cpu_set) > 0) {
|
if (hwloc_bitmap_weight(helper_cpu_set) > 0) {
|
||||||
return new HelperThread(helper_cpu_set, is8MB);
|
return new HelperThread(helper_cpu_set, priority, is8MB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -761,7 +765,7 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
|
|||||||
|
|
||||||
|
|
||||||
void benchmark() {}
|
void benchmark() {}
|
||||||
HelperThread* create_helper_thread(int64_t, const std::vector<int64_t>&) { return nullptr; }
|
HelperThread* create_helper_thread(int64_t, int, const std::vector<int64_t>&) { return nullptr; }
|
||||||
void destroy_helper_thread(HelperThread*) {}
|
void destroy_helper_thread(HelperThread*) {}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace ghostrider
|
|||||||
struct HelperThread;
|
struct HelperThread;
|
||||||
|
|
||||||
void benchmark();
|
void benchmark();
|
||||||
HelperThread* create_helper_thread(int64_t cpu_index, const std::vector<int64_t>& affinities);
|
HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector<int64_t>& affinities);
|
||||||
void destroy_helper_thread(HelperThread* t);
|
void destroy_helper_thread(HelperThread* t);
|
||||||
void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread* helper, bool verbose = true);
|
void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread* helper, bool verbose = true);
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ void xmrig::RxQueue::backgroundInit()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update seed here again in case there was more than one item in the queue
|
||||||
|
m_seed = item.seed;
|
||||||
m_state = STATE_IDLE;
|
m_state = STATE_IDLE;
|
||||||
m_async->send();
|
m_async->send();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ public:
|
|||||||
|
|
||||||
inline JobResult(const Job &job, uint64_t nonce, const uint8_t *result, const uint8_t* header_hash = nullptr, const uint8_t *mix_hash = nullptr, const uint8_t* miner_signature = nullptr) :
|
inline JobResult(const Job &job, uint64_t nonce, const uint8_t *result, const uint8_t* header_hash = nullptr, const uint8_t *mix_hash = nullptr, const uint8_t* miner_signature = nullptr) :
|
||||||
algorithm(job.algorithm()),
|
algorithm(job.algorithm()),
|
||||||
|
index(job.index()),
|
||||||
clientId(job.clientId()),
|
clientId(job.clientId()),
|
||||||
jobId(job.id()),
|
jobId(job.id()),
|
||||||
backend(job.backend()),
|
backend(job.backend()),
|
||||||
nonce(nonce),
|
nonce(nonce),
|
||||||
diff(job.diff()),
|
diff(job.diff())
|
||||||
index(job.index())
|
|
||||||
{
|
{
|
||||||
memcpy(m_result, result, sizeof(m_result));
|
memcpy(m_result, result, sizeof(m_result));
|
||||||
|
|
||||||
@@ -70,12 +70,12 @@ public:
|
|||||||
|
|
||||||
inline JobResult(const Job &job) :
|
inline JobResult(const Job &job) :
|
||||||
algorithm(job.algorithm()),
|
algorithm(job.algorithm()),
|
||||||
|
index(job.index()),
|
||||||
clientId(job.clientId()),
|
clientId(job.clientId()),
|
||||||
jobId(job.id()),
|
jobId(job.id()),
|
||||||
backend(job.backend()),
|
backend(job.backend()),
|
||||||
nonce(0),
|
nonce(0),
|
||||||
diff(0),
|
diff(0)
|
||||||
index(job.index())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,12 +88,12 @@ public:
|
|||||||
inline const uint8_t *minerSignature() const { return m_hasMinerSignature ? m_minerSignature : nullptr; }
|
inline const uint8_t *minerSignature() const { return m_hasMinerSignature ? m_minerSignature : nullptr; }
|
||||||
|
|
||||||
const Algorithm algorithm;
|
const Algorithm algorithm;
|
||||||
|
const uint8_t index;
|
||||||
const String clientId;
|
const String clientId;
|
||||||
const String jobId;
|
const String jobId;
|
||||||
const uint32_t backend;
|
const uint32_t backend;
|
||||||
const uint64_t nonce;
|
const uint64_t nonce;
|
||||||
const uint64_t diff;
|
const uint64_t diff;
|
||||||
const uint8_t index;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t m_result[32] = { 0 };
|
uint8_t m_result[32] = { 0 };
|
||||||
|
|||||||
Reference in New Issue
Block a user