mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-25 12:06:04 +00:00
Merge branch 'bug-nonce-overflow' into dev
This commit is contained in:
commit
aacdbc360b
13 changed files with 106 additions and 42 deletions
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -64,13 +64,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void nextRound(uint32_t rounds, uint32_t roundSize)
|
inline bool nextRound(uint32_t rounds, uint32_t roundSize)
|
||||||
{
|
{
|
||||||
|
bool ok = true;
|
||||||
m_rounds[index()]++;
|
m_rounds[index()]++;
|
||||||
|
|
||||||
if ((m_rounds[index()] % rounds) == 0) {
|
if ((m_rounds[index()] % rounds) == 0) {
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
*nonce(i) = Nonce::next(index(), *nonce(i), rounds * roundSize, currentJob().isNicehash());
|
*nonce(i) = Nonce::next(index(), *nonce(i), rounds * roundSize, currentJob().isNicehash(), &ok);
|
||||||
|
if (!ok) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -78,6 +82,8 @@ public:
|
||||||
*nonce(i) += roundSize;
|
*nonce(i) += roundSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,16 +120,19 @@ inline uint32_t *xmrig::WorkerJob<1>::nonce(size_t)
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
inline bool xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
||||||
{
|
{
|
||||||
|
bool ok = true;
|
||||||
m_rounds[index()]++;
|
m_rounds[index()]++;
|
||||||
|
|
||||||
if ((m_rounds[index()] % rounds) == 0) {
|
if ((m_rounds[index()] % rounds) == 0) {
|
||||||
*nonce() = Nonce::next(index(), *nonce(), rounds * roundSize, currentJob().isNicehash());
|
*nonce() = Nonce::next(index(), *nonce(), rounds * roundSize, currentJob().isNicehash(), &ok);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*nonce() += roundSize;
|
*nonce() += roundSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -48,6 +48,20 @@ namespace xmrig {
|
||||||
|
|
||||||
static constexpr uint32_t kReserveCount = 32768;
|
static constexpr uint32_t kReserveCount = 32768;
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
inline bool nextRound(WorkerJob<N> &job)
|
||||||
|
{
|
||||||
|
if (!job.nextRound(kReserveCount, 1)) {
|
||||||
|
JobResults::done(job.currentJob());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,14 +235,20 @@ void xmrig::CpuWorker<N>::start()
|
||||||
first = false;
|
first = false;
|
||||||
randomx_calculate_hash_first(m_vm->get(), tempHash, m_job.blob(), job.size());
|
randomx_calculate_hash_first(m_vm->get(), tempHash, m_job.blob(), job.size());
|
||||||
}
|
}
|
||||||
m_job.nextRound(kReserveCount, 1);
|
|
||||||
|
if (!nextRound(m_job)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
randomx_calculate_hash_next(m_vm->get(), tempHash, m_job.blob(), job.size(), m_hash);
|
randomx_calculate_hash_next(m_vm->get(), tempHash, m_job.blob(), job.size(), m_hash);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
fn(job.algorithm())(m_job.blob(), job.size(), m_hash, m_ctx, job.height());
|
fn(job.algorithm())(m_job.blob(), job.size(), m_hash, m_ctx, job.height());
|
||||||
m_job.nextRound(kReserveCount, 1);
|
if (!nextRound(m_job)) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -139,7 +139,9 @@ void xmrig::CudaWorker::start()
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t batch_size = intensity();
|
const size_t batch_size = intensity();
|
||||||
m_job.nextRound(roundSize(batch_size), batch_size);
|
if (!m_job.nextRound(roundSize(batch_size), batch_size)) {
|
||||||
|
JobResults::done(m_job.currentJob());
|
||||||
|
}
|
||||||
|
|
||||||
storeStats();
|
storeStats();
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "backend/opencl/OclWorker.h"
|
#include "backend/opencl/OclWorker.h"
|
||||||
|
|
||||||
#include "backend/common/Tags.h"
|
#include "backend/common/Tags.h"
|
||||||
#include "backend/opencl/runners/OclCnRunner.h"
|
#include "backend/opencl/runners/OclCnRunner.h"
|
||||||
#include "backend/opencl/runners/tools/OclSharedData.h"
|
#include "backend/opencl/runners/tools/OclSharedData.h"
|
||||||
|
@ -187,7 +186,9 @@ void xmrig::OclWorker::start()
|
||||||
JobResults::submit(m_job.currentJob(), results, results[0xFF]);
|
JobResults::submit(m_job.currentJob(), results, results[0xFF]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_job.nextRound(roundSize(m_intensity), m_intensity);
|
if (!m_job.nextRound(roundSize(m_intensity), m_intensity)) {
|
||||||
|
JobResults::done(m_job.currentJob());
|
||||||
|
}
|
||||||
|
|
||||||
storeStats(t);
|
storeStats(t);
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
|
||||||
* Copyright 2019 jtgrassie <https://github.com/jtgrassie>
|
* Copyright 2019 jtgrassie <https://github.com/jtgrassie>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -181,11 +181,17 @@ int64_t xmrig::Client::send(const rapidjson::Value &obj)
|
||||||
int64_t xmrig::Client::submit(const JobResult &result)
|
int64_t xmrig::Client::submit(const JobResult &result)
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_PROXY_PROJECT
|
# ifndef XMRIG_PROXY_PROJECT
|
||||||
if (result.clientId != m_rpcId) {
|
if (result.clientId != m_rpcId || m_state != ConnectedState) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
if (result.diff == 0) {
|
||||||
|
close();
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
||||||
# ifdef XMRIG_PROXY_PROJECT
|
# ifdef XMRIG_PROXY_PROJECT
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,12 +23,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
|
|
||||||
#include "crypto/common/Nonce.h"
|
#include "crypto/common/Nonce.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,13 +54,23 @@ xmrig::Nonce::Nonce()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t xmrig::Nonce::next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash)
|
uint32_t xmrig::Nonce::next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash, bool *ok)
|
||||||
{
|
{
|
||||||
uint32_t next;
|
uint32_t next;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
|
||||||
if (nicehash) {
|
if (nicehash) {
|
||||||
|
if ((m_nonces[index] + reserveCount) > 0x1000000) {
|
||||||
|
if (ok) {
|
||||||
|
*ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pause(true);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
next = (nonce & 0xFF000000) | m_nonces[index];
|
next = (nonce & 0xFF000000) | m_nonces[index];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
static inline void stop(Backend backend) { m_sequence[backend] = 0; }
|
static inline void stop(Backend backend) { m_sequence[backend] = 0; }
|
||||||
static inline void touch(Backend backend) { m_sequence[backend]++; }
|
static inline void touch(Backend backend) { m_sequence[backend]++; }
|
||||||
|
|
||||||
static uint32_t next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash);
|
static uint32_t next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash, bool *ok = nullptr);
|
||||||
static void reset(uint8_t index);
|
static void reset(uint8_t index);
|
||||||
static void stop();
|
static void stop();
|
||||||
static void touch();
|
static void touch();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -55,6 +55,17 @@ public:
|
||||||
memcpy(m_result, result, sizeof(m_result));
|
memcpy(m_result, result, sizeof(m_result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline JobResult(const Job &job) :
|
||||||
|
algorithm(job.algorithm()),
|
||||||
|
clientId(job.clientId()),
|
||||||
|
jobId(job.id()),
|
||||||
|
backend(job.backend()),
|
||||||
|
nonce(0),
|
||||||
|
diff(0),
|
||||||
|
index(job.index())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
inline const uint8_t *result() const { return m_result; }
|
inline const uint8_t *result() const { return m_result; }
|
||||||
inline uint64_t actualDiff() const { return Job::toDiff(reinterpret_cast<const uint64_t*>(m_result)[3]); }
|
inline uint64_t actualDiff() const { return Job::toDiff(reinterpret_cast<const uint64_t*>(m_result)[3]); }
|
||||||
inline uint8_t *result() { return m_result; }
|
inline uint8_t *result() { return m_result; }
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "net/JobResults.h"
|
#include "net/JobResults.h"
|
||||||
|
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/tools/Handle.h"
|
#include "base/tools/Handle.h"
|
||||||
#include "base/tools/Object.h"
|
#include "base/tools/Object.h"
|
||||||
|
@ -272,6 +271,11 @@ static JobResultsPrivate *handler = nullptr;
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::JobResults::done(const Job &job)
|
||||||
|
{
|
||||||
|
submit(JobResult(job));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::JobResults::setListener(IJobResultListener *listener, bool hwAES)
|
void xmrig::JobResults::setListener(IJobResultListener *listener, bool hwAES)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -42,6 +42,7 @@ class JobResult;
|
||||||
class JobResults
|
class JobResults
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static void done(const Job &job);
|
||||||
static void setListener(IJobResultListener *listener, bool hwAES);
|
static void setListener(IJobResultListener *listener, bool hwAES);
|
||||||
static void stop();
|
static void stop();
|
||||||
static void submit(const Job &job, uint32_t nonce, const uint8_t *result);
|
static void submit(const Job &job, uint32_t nonce, const uint8_t *result);
|
||||||
|
|
Loading…
Reference in a new issue