mirror of
https://github.com/xmrig/xmrig.git
synced 2026-02-02 10:03:05 -05:00
xmrig v2.13.0 rebase
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||
*
|
||||
@@ -54,8 +55,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
int64_t Client::m_sequence = 1;
|
||||
xmrig::Storage<Client> Client::m_storage;
|
||||
Storage<Client> Client::m_storage;
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
@@ -69,7 +74,7 @@ static const char *states[] = {
|
||||
#endif
|
||||
|
||||
|
||||
Client::Client(int id, const char *agent, IClientListener *listener) :
|
||||
xmrig::Client::Client(int id, const char *agent, IClientListener *listener) :
|
||||
m_ipv6(false),
|
||||
m_nicehash(false),
|
||||
m_quiet(false),
|
||||
@@ -106,13 +111,13 @@ Client::Client(int id, const char *agent, IClientListener *listener) :
|
||||
}
|
||||
|
||||
|
||||
Client::~Client()
|
||||
xmrig::Client::~Client()
|
||||
{
|
||||
delete m_socket;
|
||||
}
|
||||
|
||||
|
||||
void Client::connect()
|
||||
void xmrig::Client::connect()
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
if (m_pool.isTLS()) {
|
||||
@@ -129,14 +134,14 @@ void Client::connect()
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
void Client::connect(const Pool &url)
|
||||
void xmrig::Client::connect(const Pool &url)
|
||||
{
|
||||
setPool(url);
|
||||
connect();
|
||||
}
|
||||
|
||||
|
||||
void Client::deleteLater()
|
||||
void xmrig::Client::deleteLater()
|
||||
{
|
||||
if (!m_listener) {
|
||||
return;
|
||||
@@ -151,7 +156,7 @@ void Client::deleteLater()
|
||||
|
||||
|
||||
|
||||
void Client::setPool(const Pool &pool)
|
||||
void xmrig::Client::setPool(const Pool &pool)
|
||||
{
|
||||
if (!pool.isValid()) {
|
||||
return;
|
||||
@@ -161,7 +166,7 @@ void Client::setPool(const Pool &pool)
|
||||
}
|
||||
|
||||
|
||||
void Client::tick(uint64_t now)
|
||||
void xmrig::Client::tick(uint64_t now)
|
||||
{
|
||||
if (m_state == ConnectedState) {
|
||||
if (m_expire && now > m_expire) {
|
||||
@@ -179,7 +184,7 @@ void Client::tick(uint64_t now)
|
||||
}
|
||||
|
||||
|
||||
bool Client::disconnect()
|
||||
bool xmrig::Client::disconnect()
|
||||
{
|
||||
m_keepAlive = 0;
|
||||
m_expire = 0;
|
||||
@@ -189,7 +194,7 @@ bool Client::disconnect()
|
||||
}
|
||||
|
||||
|
||||
const char *Client::tlsFingerprint() const
|
||||
const char *xmrig::Client::tlsFingerprint() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
if (isTLS() && m_pool.fingerprint() == nullptr) {
|
||||
@@ -201,7 +206,7 @@ const char *Client::tlsFingerprint() const
|
||||
}
|
||||
|
||||
|
||||
const char *Client::tlsVersion() const
|
||||
const char *xmrig::Client::tlsVersion() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
if (isTLS()) {
|
||||
@@ -213,7 +218,7 @@ const char *Client::tlsVersion() const
|
||||
}
|
||||
|
||||
|
||||
int64_t Client::submit(const JobResult &result)
|
||||
int64_t xmrig::Client::submit(const JobResult &result)
|
||||
{
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
if (result.clientId != m_rpcId) {
|
||||
@@ -221,10 +226,6 @@ int64_t Client::submit(const JobResult &result)
|
||||
}
|
||||
# endif
|
||||
|
||||
if (m_job.algorithm().variant() == xmrig::VARIANT_WOW && m_job.id() != result.jobId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
using namespace rapidjson;
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
@@ -270,7 +271,7 @@ int64_t Client::submit(const JobResult &result)
|
||||
}
|
||||
|
||||
|
||||
bool Client::close()
|
||||
bool xmrig::Client::close()
|
||||
{
|
||||
if (m_state == ClosingState) {
|
||||
return m_socket != nullptr;
|
||||
@@ -290,7 +291,7 @@ bool Client::close()
|
||||
}
|
||||
|
||||
|
||||
bool Client::isCriticalError(const char *message)
|
||||
bool xmrig::Client::isCriticalError(const char *message)
|
||||
{
|
||||
if (!message) {
|
||||
return false;
|
||||
@@ -312,7 +313,7 @@ bool Client::isCriticalError(const char *message)
|
||||
}
|
||||
|
||||
|
||||
bool Client::isTLS() const
|
||||
bool xmrig::Client::isTLS() const
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
return m_pool.isTLS() && m_tls;
|
||||
@@ -322,7 +323,7 @@ bool Client::isTLS() const
|
||||
}
|
||||
|
||||
|
||||
bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||
bool xmrig::Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||
{
|
||||
if (!params.IsObject()) {
|
||||
*code = 2;
|
||||
@@ -399,7 +400,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||
}
|
||||
|
||||
|
||||
bool Client::parseLogin(const rapidjson::Value &result, int *code)
|
||||
bool xmrig::Client::parseLogin(const rapidjson::Value &result, int *code)
|
||||
{
|
||||
if (!m_rpcId.setId(result["id"].GetString())) {
|
||||
*code = 1;
|
||||
@@ -419,7 +420,7 @@ bool Client::parseLogin(const rapidjson::Value &result, int *code)
|
||||
}
|
||||
|
||||
|
||||
bool Client::send(BIO *bio)
|
||||
bool xmrig::Client::send(BIO *bio)
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
uv_buf_t buf;
|
||||
@@ -452,10 +453,10 @@ bool Client::send(BIO *bio)
|
||||
}
|
||||
|
||||
|
||||
bool Client::verifyAlgorithm(const xmrig::Algorithm &algorithm) const
|
||||
bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm) const
|
||||
{
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_pool.algorithm().variant() == xmrig::VARIANT_AUTO || m_id == -1) {
|
||||
if (m_pool.algorithm().variant() == VARIANT_AUTO || m_id == -1) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
@@ -479,7 +480,7 @@ bool Client::verifyAlgorithm(const xmrig::Algorithm &algorithm) const
|
||||
}
|
||||
|
||||
|
||||
int Client::resolve(const char *host)
|
||||
int xmrig::Client::resolve(const char *host)
|
||||
{
|
||||
setState(HostLookupState);
|
||||
|
||||
@@ -502,7 +503,7 @@ int Client::resolve(const char *host)
|
||||
}
|
||||
|
||||
|
||||
int64_t Client::send(const rapidjson::Document &doc)
|
||||
int64_t xmrig::Client::send(const rapidjson::Document &doc)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
@@ -525,7 +526,7 @@ int64_t Client::send(const rapidjson::Document &doc)
|
||||
}
|
||||
|
||||
|
||||
int64_t Client::send(size_t size)
|
||||
int64_t xmrig::Client::send(size_t size)
|
||||
{
|
||||
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", m_pool.url(), size, m_sendBuf);
|
||||
|
||||
@@ -556,7 +557,7 @@ int64_t Client::send(size_t size)
|
||||
}
|
||||
|
||||
|
||||
void Client::connect(const std::vector<addrinfo*> &ipv4, const std::vector<addrinfo*> &ipv6)
|
||||
void xmrig::Client::connect(const std::vector<addrinfo*> &ipv4, const std::vector<addrinfo*> &ipv6)
|
||||
{
|
||||
addrinfo *addr = nullptr;
|
||||
m_ipv6 = ipv4.empty() && !ipv6.empty();
|
||||
@@ -574,7 +575,7 @@ void Client::connect(const std::vector<addrinfo*> &ipv4, const std::vector<addri
|
||||
}
|
||||
|
||||
|
||||
void Client::connect(sockaddr *addr)
|
||||
void xmrig::Client::connect(sockaddr *addr)
|
||||
{
|
||||
setState(ConnectingState);
|
||||
|
||||
@@ -597,7 +598,7 @@ void Client::connect(sockaddr *addr)
|
||||
}
|
||||
|
||||
|
||||
void Client::handshake()
|
||||
void xmrig::Client::handshake()
|
||||
{
|
||||
# ifndef XMRIG_NO_TLS
|
||||
if (isTLS()) {
|
||||
@@ -613,7 +614,7 @@ void Client::handshake()
|
||||
}
|
||||
|
||||
|
||||
void Client::login()
|
||||
void xmrig::Client::login()
|
||||
{
|
||||
using namespace rapidjson;
|
||||
m_results.clear();
|
||||
@@ -663,7 +664,7 @@ void Client::login()
|
||||
}
|
||||
|
||||
|
||||
void Client::onClose()
|
||||
void xmrig::Client::onClose()
|
||||
{
|
||||
delete m_socket;
|
||||
|
||||
@@ -682,7 +683,7 @@ void Client::onClose()
|
||||
}
|
||||
|
||||
|
||||
void Client::parse(char *line, size_t len)
|
||||
void xmrig::Client::parse(char *line, size_t len)
|
||||
{
|
||||
startTimeout();
|
||||
|
||||
@@ -721,7 +722,7 @@ void Client::parse(char *line, size_t len)
|
||||
}
|
||||
|
||||
|
||||
void Client::parseExtensions(const rapidjson::Value &value)
|
||||
void xmrig::Client::parseExtensions(const rapidjson::Value &value)
|
||||
{
|
||||
m_extensions = 0;
|
||||
|
||||
@@ -748,7 +749,7 @@ void Client::parseExtensions(const rapidjson::Value &value)
|
||||
}
|
||||
|
||||
|
||||
void Client::parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error)
|
||||
void xmrig::Client::parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error)
|
||||
{
|
||||
if (error.IsObject()) {
|
||||
if (!isQuiet()) {
|
||||
@@ -774,7 +775,7 @@ void Client::parseNotification(const char *method, const rapidjson::Value ¶m
|
||||
}
|
||||
|
||||
|
||||
void Client::parseResponse(int64_t id, const rapidjson::Value &result, const rapidjson::Value &error)
|
||||
void xmrig::Client::parseResponse(int64_t id, const rapidjson::Value &result, const rapidjson::Value &error)
|
||||
{
|
||||
if (error.IsObject()) {
|
||||
const char *message = error["message"].GetString();
|
||||
@@ -826,13 +827,13 @@ void Client::parseResponse(int64_t id, const rapidjson::Value &result, const rap
|
||||
}
|
||||
|
||||
|
||||
void Client::ping()
|
||||
void xmrig::Client::ping()
|
||||
{
|
||||
send(snprintf(m_sendBuf, sizeof(m_sendBuf), "{\"id\":%" PRId64 ",\"jsonrpc\":\"2.0\",\"method\":\"keepalived\",\"params\":{\"id\":\"%s\"}}\n", m_sequence, m_rpcId.data()));
|
||||
}
|
||||
|
||||
|
||||
void Client::read()
|
||||
void xmrig::Client::read()
|
||||
{
|
||||
char* end;
|
||||
char* start = m_recvBuf.base;
|
||||
@@ -861,7 +862,7 @@ void Client::read()
|
||||
}
|
||||
|
||||
|
||||
void Client::reconnect()
|
||||
void xmrig::Client::reconnect()
|
||||
{
|
||||
if (!m_listener) {
|
||||
m_storage.remove(m_key);
|
||||
@@ -884,7 +885,7 @@ void Client::reconnect()
|
||||
}
|
||||
|
||||
|
||||
void Client::setState(SocketState state)
|
||||
void xmrig::Client::setState(SocketState state)
|
||||
{
|
||||
LOG_DEBUG("[%s] state: \"%s\"", m_pool.url(), states[state]);
|
||||
|
||||
@@ -896,7 +897,7 @@ void Client::setState(SocketState state)
|
||||
}
|
||||
|
||||
|
||||
void Client::startTimeout()
|
||||
void xmrig::Client::startTimeout()
|
||||
{
|
||||
m_expire = 0;
|
||||
|
||||
@@ -906,7 +907,7 @@ void Client::startTimeout()
|
||||
}
|
||||
|
||||
|
||||
void Client::onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
|
||||
void xmrig::Client::onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
|
||||
{
|
||||
auto client = getClient(handle->data);
|
||||
if (!client) {
|
||||
@@ -918,7 +919,7 @@ void Client::onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t
|
||||
}
|
||||
|
||||
|
||||
void Client::onClose(uv_handle_t *handle)
|
||||
void xmrig::Client::onClose(uv_handle_t *handle)
|
||||
{
|
||||
auto client = getClient(handle->data);
|
||||
if (!client) {
|
||||
@@ -929,7 +930,7 @@ void Client::onClose(uv_handle_t *handle)
|
||||
}
|
||||
|
||||
|
||||
void Client::onConnect(uv_connect_t *req, int status)
|
||||
void xmrig::Client::onConnect(uv_connect_t *req, int status)
|
||||
{
|
||||
auto client = getClient(req->data);
|
||||
if (!client) {
|
||||
@@ -958,7 +959,7 @@ void Client::onConnect(uv_connect_t *req, int status)
|
||||
}
|
||||
|
||||
|
||||
void Client::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
|
||||
void xmrig::Client::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
|
||||
{
|
||||
auto client = getClient(stream->data);
|
||||
if (!client) {
|
||||
@@ -1001,7 +1002,7 @@ void Client::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
|
||||
}
|
||||
|
||||
|
||||
void Client::onResolved(uv_getaddrinfo_t *req, int status, struct addrinfo *res)
|
||||
void xmrig::Client::onResolved(uv_getaddrinfo_t *req, int status, struct addrinfo *res)
|
||||
{
|
||||
auto client = getClient(req->data);
|
||||
if (!client) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||
*
|
||||
@@ -31,22 +32,25 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "base/net/Pool.h"
|
||||
#include "common/crypto/Algorithm.h"
|
||||
#include "common/net/Id.h"
|
||||
#include "common/net/Job.h"
|
||||
#include "common/net/Pool.h"
|
||||
#include "common/net/Storage.h"
|
||||
#include "common/net/SubmitResult.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
typedef struct bio_st BIO;
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class IClientListener;
|
||||
class JobResult;
|
||||
|
||||
|
||||
typedef struct bio_st BIO;
|
||||
|
||||
|
||||
class Client
|
||||
{
|
||||
public:
|
||||
@@ -86,7 +90,7 @@ public:
|
||||
inline int id() const { return m_id; }
|
||||
inline SocketState state() const { return m_state; }
|
||||
inline uint16_t port() const { return m_pool.port(); }
|
||||
inline void setAlgo(const xmrig::Algorithm &algo) { m_pool.setAlgo(algo); }
|
||||
inline void setAlgo(const Algorithm &algo) { m_pool.setAlgo(algo); }
|
||||
inline void setQuiet(bool quiet) { m_quiet = quiet; }
|
||||
inline void setRetries(int retries) { m_retries = retries; }
|
||||
inline void setRetryPause(int ms) { m_retryPause = ms; }
|
||||
@@ -106,7 +110,7 @@ private:
|
||||
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
||||
bool parseLogin(const rapidjson::Value &result, int *code);
|
||||
bool send(BIO *bio);
|
||||
bool verifyAlgorithm(const xmrig::Algorithm &algorithm) const;
|
||||
bool verifyAlgorithm(const Algorithm &algorithm) const;
|
||||
int resolve(const char *host);
|
||||
int64_t send(const rapidjson::Document &doc);
|
||||
int64_t send(size_t size);
|
||||
@@ -163,11 +167,14 @@ private:
|
||||
uv_getaddrinfo_t m_resolver;
|
||||
uv_stream_t *m_stream;
|
||||
uv_tcp_t *m_socket;
|
||||
xmrig::Id m_rpcId;
|
||||
Id m_rpcId;
|
||||
|
||||
static int64_t m_sequence;
|
||||
static xmrig::Storage<Client> m_storage;
|
||||
static Storage<Client> m_storage;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CLIENT_H */
|
||||
|
||||
@@ -59,7 +59,7 @@ char hf_bin2hex(unsigned char c)
|
||||
}
|
||||
|
||||
|
||||
Job::Job() :
|
||||
xmrig::Job::Job() :
|
||||
m_autoVariant(false),
|
||||
m_nicehash(false),
|
||||
m_poolId(-2),
|
||||
@@ -73,8 +73,8 @@ Job::Job() :
|
||||
}
|
||||
|
||||
|
||||
Job::Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmrig::Id &clientId) :
|
||||
m_autoVariant(algorithm.variant() == xmrig::VARIANT_AUTO),
|
||||
xmrig::Job::Job(int poolId, bool nicehash, const Algorithm &algorithm, const Id &clientId) :
|
||||
m_autoVariant(algorithm.variant() == VARIANT_AUTO),
|
||||
m_nicehash(nicehash),
|
||||
m_poolId(poolId),
|
||||
m_threadId(-1),
|
||||
@@ -89,18 +89,18 @@ Job::Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmr
|
||||
}
|
||||
|
||||
|
||||
Job::~Job()
|
||||
xmrig::Job::~Job()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool Job::isEqual(const Job &other) const
|
||||
bool xmrig::Job::isEqual(const Job &other) const
|
||||
{
|
||||
return m_id == other.m_id && m_clientId == other.m_clientId && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0;
|
||||
}
|
||||
|
||||
|
||||
bool Job::setBlob(const char *blob)
|
||||
bool xmrig::Job::setBlob(const char *blob)
|
||||
{
|
||||
if (!blob) {
|
||||
return false;
|
||||
@@ -129,14 +129,14 @@ bool Job::setBlob(const char *blob)
|
||||
}
|
||||
|
||||
if (!m_algorithm.isForced()) {
|
||||
if (m_algorithm.variant() == xmrig::VARIANT_XTL && m_blob[0] >= 9) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_HALF);
|
||||
if (m_algorithm.variant() == VARIANT_XTL && m_blob[0] >= 9) {
|
||||
m_algorithm.setVariant(VARIANT_HALF);
|
||||
}
|
||||
else if (m_algorithm.variant() == xmrig::VARIANT_MSR && m_blob[0] >= 8) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_HALF);
|
||||
else if (m_algorithm.variant() == VARIANT_MSR && m_blob[0] >= 8) {
|
||||
m_algorithm.setVariant(VARIANT_HALF);
|
||||
}
|
||||
else if (m_algorithm.variant() == xmrig::VARIANT_WOW && m_blob[0] < 11) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_2);
|
||||
else if (m_algorithm.variant() == VARIANT_WOW && m_blob[0] < 11) {
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ void Job::setRawBlob(const uint8_t *blob, const size_t size)
|
||||
}
|
||||
|
||||
|
||||
bool Job::setTarget(const char *target)
|
||||
bool xmrig::Job::setTarget(const char *target)
|
||||
{
|
||||
if (!target) {
|
||||
return false;
|
||||
@@ -197,7 +197,7 @@ bool Job::setTarget(const char *target)
|
||||
}
|
||||
|
||||
|
||||
void Job::setAlgorithm(const char *algo)
|
||||
void xmrig::Job::setAlgorithm(const char *algo)
|
||||
{
|
||||
m_algorithm.parseAlgorithm(algo);
|
||||
|
||||
@@ -207,13 +207,13 @@ void Job::setAlgorithm(const char *algo)
|
||||
}
|
||||
|
||||
|
||||
void Job::setHeight(uint64_t height)
|
||||
void xmrig::Job::setHeight(uint64_t height)
|
||||
{
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
|
||||
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
bool xmrig::Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
{
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < len; i += 2) {
|
||||
@@ -227,7 +227,7 @@ bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
}
|
||||
|
||||
|
||||
void Job::toHex(const unsigned char* in, unsigned int len, char* out)
|
||||
void xmrig::Job::toHex(const unsigned char* in, unsigned int len, char* out)
|
||||
{
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
out[i * 2] = hf_bin2hex((in[i] & 0xF0) >> 4);
|
||||
@@ -237,7 +237,7 @@ void Job::toHex(const unsigned char* in, unsigned int len, char* out)
|
||||
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
char *Job::toHex(const unsigned char* in, unsigned int len)
|
||||
char *xmrig::Job::toHex(const unsigned char* in, unsigned int len)
|
||||
{
|
||||
char *out = new char[len * 2 + 1]();
|
||||
toHex(in, len, out);
|
||||
@@ -247,13 +247,11 @@ char *Job::toHex(const unsigned char* in, unsigned int len)
|
||||
#endif
|
||||
|
||||
|
||||
xmrig::Variant Job::variant() const
|
||||
xmrig::Variant xmrig::Job::variant() const
|
||||
{
|
||||
using namespace xmrig;
|
||||
|
||||
switch (m_algorithm.algo()) {
|
||||
case CRYPTONIGHT:
|
||||
return (m_blob[0] >= 8) ? VARIANT_2 : VARIANT_1;
|
||||
return (m_blob[0] >= 10) ? VARIANT_4 : ((m_blob[0] >= 8) ? VARIANT_2 : VARIANT_1);
|
||||
|
||||
case CRYPTONIGHT_LITE:
|
||||
return VARIANT_1;
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "common/net/Id.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Job
|
||||
{
|
||||
public:
|
||||
@@ -44,7 +47,7 @@ public:
|
||||
static constexpr const size_t kMaxBlobSize = 128;
|
||||
|
||||
Job();
|
||||
Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmrig::Id &clientId);
|
||||
Job(int poolId, bool nicehash, const Algorithm &algorithm, const Id &clientId);
|
||||
~Job();
|
||||
|
||||
bool isEqual(const Job &other) const;
|
||||
@@ -61,9 +64,9 @@ public:
|
||||
inline bool setId(const char *id) { return m_id.setId(id); }
|
||||
inline const uint32_t *nonce() const { return reinterpret_cast<const uint32_t*>(m_blob + 39); }
|
||||
inline const uint8_t *blob() const { return m_blob; }
|
||||
inline const xmrig::Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const xmrig::Id &clientId() const { return m_clientId; }
|
||||
inline const xmrig::Id &id() const { return m_id; }
|
||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const Id &clientId() const { return m_clientId; }
|
||||
inline const Id &id() const { return m_id; }
|
||||
inline int poolId() const { return m_poolId; }
|
||||
inline int threadId() const { return m_threadId; }
|
||||
inline size_t size() const { return m_size; }
|
||||
@@ -72,7 +75,7 @@ public:
|
||||
inline uint64_t target() const { return m_target; }
|
||||
inline uint64_t height() const { return m_height; }
|
||||
inline void reset() { m_size = 0; m_diff = 0; }
|
||||
inline void setClientId(const xmrig::Id &id) { m_clientId = id; }
|
||||
inline void setClientId(const Id &id) { m_clientId = id; }
|
||||
inline void setPoolId(int poolId) { m_poolId = poolId; }
|
||||
inline void setThreadId(int threadId) { m_threadId = threadId; }
|
||||
inline void setVariant(const char *variant) { m_algorithm.parseVariant(variant); }
|
||||
@@ -96,7 +99,7 @@ public:
|
||||
inline bool operator!=(const Job &other) const { return !isEqual(other); }
|
||||
|
||||
private:
|
||||
xmrig::Variant variant() const;
|
||||
Variant variant() const;
|
||||
|
||||
bool m_autoVariant;
|
||||
bool m_nicehash;
|
||||
@@ -117,4 +120,8 @@ private:
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_JOB_H */
|
||||
|
||||
@@ -1,408 +0,0 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "common/net/Pool.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
# include "common/log/Log.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define strncasecmp _strnicmp
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
|
||||
Pool::Pool() :
|
||||
m_nicehash(false),
|
||||
m_tls(false),
|
||||
m_keepAlive(0),
|
||||
m_port(kDefaultPort)
|
||||
{
|
||||
// here xmrig now reports all possible supported algorithms
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_1));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_2));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_0));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_RTO));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT, xmrig::VARIANT_WOW));
|
||||
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0));
|
||||
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV));
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE));
|
||||
|
||||
m_algorithms.push_back(xmrig::Algorithm(xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Parse url.
|
||||
*
|
||||
* Valid urls:
|
||||
* example.com
|
||||
* example.com:3333
|
||||
* stratum+tcp://example.com
|
||||
* stratum+tcp://example.com:3333
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
Pool::Pool(const char *url) :
|
||||
m_nicehash(false),
|
||||
m_tls(false),
|
||||
m_keepAlive(0),
|
||||
m_port(kDefaultPort)
|
||||
{
|
||||
parse(url);
|
||||
}
|
||||
|
||||
|
||||
Pool::Pool(const char *host, uint16_t port, const char *user, const char *password, int keepAlive, bool nicehash, bool tls) :
|
||||
m_nicehash(nicehash),
|
||||
m_tls(tls),
|
||||
m_keepAlive(keepAlive),
|
||||
m_port(port),
|
||||
m_host(host),
|
||||
m_password(password),
|
||||
m_user(user)
|
||||
{
|
||||
const size_t size = m_host.size() + 8;
|
||||
assert(size > 8);
|
||||
|
||||
char *url = static_cast<char *>(malloc(size));
|
||||
snprintf(url, size - 1, "%s:%d", m_host.data(), m_port);
|
||||
|
||||
m_url = url;
|
||||
}
|
||||
|
||||
|
||||
bool Pool::isCompatible(const xmrig::Algorithm &algorithm) const
|
||||
{
|
||||
if (m_algorithms.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const auto &a : m_algorithms) {
|
||||
if (algorithm == a) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_algorithm.algo() == xmrig::CRYPTONIGHT && algorithm.algo() == xmrig::CRYPTONIGHT) {
|
||||
return m_algorithm.variant() == xmrig::VARIANT_XTL || m_algorithm.variant() == xmrig::VARIANT_MSR;
|
||||
}
|
||||
# endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Pool::isEqual(const Pool &other) const
|
||||
{
|
||||
return (m_nicehash == other.m_nicehash
|
||||
&& m_tls == other.m_tls
|
||||
&& m_keepAlive == other.m_keepAlive
|
||||
&& m_port == other.m_port
|
||||
&& m_algorithm == other.m_algorithm
|
||||
&& m_fingerprint == other.m_fingerprint
|
||||
&& m_host == other.m_host
|
||||
&& m_password == other.m_password
|
||||
&& m_rigId == other.m_rigId
|
||||
&& m_url == other.m_url
|
||||
&& m_user == other.m_user);
|
||||
}
|
||||
|
||||
|
||||
bool Pool::parse(const char *url)
|
||||
{
|
||||
assert(url != nullptr);
|
||||
|
||||
const char *p = strstr(url, "://");
|
||||
const char *base = url;
|
||||
|
||||
if (p) {
|
||||
if (strncasecmp(url, "stratum+tcp://", 14) == 0) {
|
||||
m_tls = false;
|
||||
}
|
||||
else if (strncasecmp(url, "stratum+ssl://", 14) == 0) {
|
||||
m_tls = true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
base = url + 14;
|
||||
}
|
||||
|
||||
if (!strlen(base) || *base == '/') {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_url = url;
|
||||
if (base[0] == '[') {
|
||||
return parseIPv6(base);
|
||||
}
|
||||
|
||||
const char *port = strchr(base, ':');
|
||||
if (!port) {
|
||||
m_host = base;
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t size = port++ - base + 1;
|
||||
char *host = static_cast<char *>(malloc(size));
|
||||
memcpy(host, base, size - 1);
|
||||
host[size - 1] = 0;
|
||||
|
||||
m_host = host;
|
||||
m_port = static_cast<uint16_t>(strtol(port, nullptr, 10));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Pool::setUserpass(const char *userpass)
|
||||
{
|
||||
const char *p = strchr(userpass, ':');
|
||||
if (!p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *user = static_cast<char *>(malloc(p - userpass + 1));
|
||||
strncpy(user, userpass, p - userpass);
|
||||
|
||||
m_user = user;
|
||||
m_password = p + 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value obj(kObjectType);
|
||||
|
||||
obj.AddMember("url", m_url.toJSON(), allocator);
|
||||
obj.AddMember("user", m_user.toJSON(), allocator);
|
||||
obj.AddMember("pass", m_password.toJSON(), allocator);
|
||||
obj.AddMember("rig-id", m_rigId.toJSON(), allocator);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
obj.AddMember("nicehash", isNicehash(), allocator);
|
||||
# endif
|
||||
|
||||
if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) {
|
||||
obj.AddMember("keepalive", m_keepAlive > 0, allocator);
|
||||
}
|
||||
else {
|
||||
obj.AddMember("keepalive", m_keepAlive, allocator);
|
||||
}
|
||||
|
||||
switch (m_algorithm.variant()) {
|
||||
case xmrig::VARIANT_AUTO:
|
||||
case xmrig::VARIANT_0:
|
||||
case xmrig::VARIANT_1:
|
||||
obj.AddMember("variant", m_algorithm.variant(), allocator);
|
||||
break;
|
||||
|
||||
case xmrig::VARIANT_2:
|
||||
obj.AddMember("variant", 2, allocator);
|
||||
break;
|
||||
|
||||
default:
|
||||
obj.AddMember("variant", StringRef(m_algorithm.variantName()), allocator);
|
||||
break;
|
||||
}
|
||||
|
||||
obj.AddMember("tls", isTLS(), allocator);
|
||||
obj.AddMember("tls-fingerprint", m_fingerprint.toJSON(), allocator);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
void Pool::adjust(const xmrig::Algorithm &algorithm)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
m_algorithm.setAlgo(algorithm.algo());
|
||||
adjustVariant(algorithm.variant());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Pool::setAlgo(const xmrig::Algorithm &algorithm)
|
||||
{
|
||||
m_algorithm = algorithm;
|
||||
}
|
||||
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
void Pool::print() const
|
||||
{
|
||||
LOG_NOTICE("url: %s", m_url.data());
|
||||
LOG_DEBUG ("host: %s", m_host.data());
|
||||
LOG_DEBUG ("port: %d", static_cast<int>(m_port));
|
||||
LOG_DEBUG ("user: %s", m_user.data());
|
||||
LOG_DEBUG ("pass: %s", m_password.data());
|
||||
LOG_DEBUG ("rig-id %s", m_rigId.data());
|
||||
LOG_DEBUG ("algo: %s", m_algorithm.name());
|
||||
LOG_DEBUG ("nicehash: %d", static_cast<int>(m_nicehash));
|
||||
LOG_DEBUG ("keepAlive: %d", m_keepAlive);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Pool::parseIPv6(const char *addr)
|
||||
{
|
||||
const char *end = strchr(addr, ']');
|
||||
if (!end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *port = strchr(end, ':');
|
||||
if (!port) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t size = end - addr;
|
||||
char *host = static_cast<char *>(malloc(size));
|
||||
memcpy(host, addr + 1, size - 1);
|
||||
host[size - 1] = 0;
|
||||
|
||||
m_host = host;
|
||||
m_port = static_cast<uint16_t>(strtol(port + 1, nullptr, 10));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Pool::adjustVariant(const xmrig::Variant variantHint)
|
||||
{
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
using namespace xmrig;
|
||||
|
||||
if (m_host.contains(".nicehash.com")) {
|
||||
m_keepAlive = false;
|
||||
m_nicehash = true;
|
||||
bool valid = true;
|
||||
|
||||
switch (m_port) {
|
||||
case 3355:
|
||||
case 33355:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonight.");
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
break;
|
||||
|
||||
case 3363:
|
||||
case 33363:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonightv7.");
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
break;
|
||||
|
||||
case 3364:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_HEAVY && m_host.contains("cryptonightheavy.");
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
break;
|
||||
|
||||
case 3367:
|
||||
case 33367:
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT && m_host.contains("cryptonightv8.");
|
||||
m_algorithm.setVariant(VARIANT_2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
m_tls = m_port > 33000;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_host.contains(".minergate.com")) {
|
||||
m_keepAlive = false;
|
||||
bool valid = true;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
|
||||
if (m_host.contains("xmr.pool.")) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT;
|
||||
m_algorithm.setVariant(m_port == 45700 ? VARIANT_AUTO : VARIANT_0);
|
||||
}
|
||||
else if (m_host.contains("aeon.pool.") && m_port == 45690) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_LITE;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (variantHint != VARIANT_AUTO) {
|
||||
m_algorithm.setVariant(variantHint);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.variant() != VARIANT_AUTO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.algo() == CRYPTONIGHT_HEAVY) {
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
}
|
||||
else if (m_algorithm.algo() == CRYPTONIGHT_LITE) {
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 MoneroOcean <https://github.com/MoneroOcean>, <support@moneroocean.stream>
|
||||
*
|
||||
* 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_POOL_H
|
||||
#define XMRIG_POOL_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "common/crypto/Algorithm.h"
|
||||
#include "common/utils/c_str.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
class Pool
|
||||
{
|
||||
public:
|
||||
constexpr static const char *kDefaultPassword = "x";
|
||||
constexpr static const char *kDefaultUser = "x";
|
||||
constexpr static uint16_t kDefaultPort = 3333;
|
||||
constexpr static int kKeepAliveTimeout = 60;
|
||||
|
||||
Pool();
|
||||
Pool(const char *url);
|
||||
Pool(const char *host,
|
||||
uint16_t port,
|
||||
const char *user = nullptr,
|
||||
const char *password = nullptr,
|
||||
int keepAlive = 0,
|
||||
bool nicehash = false,
|
||||
bool tls = false
|
||||
);
|
||||
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isTLS() const { return m_tls; }
|
||||
inline bool isValid() const { return !m_host.isNull() && m_port > 0; }
|
||||
inline const char *fingerprint() const { return m_fingerprint.data(); }
|
||||
inline const char *host() const { return m_host.data(); }
|
||||
inline const char *password() const { return !m_password.isNull() ? m_password.data() : kDefaultPassword; }
|
||||
inline const char *rigId() const { return m_rigId.data(); }
|
||||
inline const char *url() const { return m_url.data(); }
|
||||
inline const char *user() const { return !m_user.isNull() ? m_user.data() : kDefaultUser; }
|
||||
inline const xmrig::Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const xmrig::Algorithms &algorithms() const { return m_algorithms; }
|
||||
inline int keepAlive() const { return m_keepAlive; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
inline void setFingerprint(const char *fingerprint) { m_fingerprint = fingerprint; }
|
||||
inline void setKeepAlive(int keepAlive) { m_keepAlive = keepAlive >= 0 ? keepAlive : 0; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
inline void setPassword(const char *password) { m_password = password; }
|
||||
inline void setRigId(const char *rigId) { m_rigId = rigId; }
|
||||
inline void setTLS(bool tls) { m_tls = tls; }
|
||||
inline void setUser(const char *user) { m_user = user; }
|
||||
inline xmrig::Algorithm &algorithm() { return m_algorithm; }
|
||||
|
||||
inline bool operator!=(const Pool &other) const { return !isEqual(other); }
|
||||
inline bool operator==(const Pool &other) const { return isEqual(other); }
|
||||
|
||||
bool isCompatible(const xmrig::Algorithm &algorithm) const;
|
||||
bool isEqual(const Pool &other) const;
|
||||
bool parse(const char *url);
|
||||
bool setUserpass(const char *userpass);
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
void adjust(const xmrig::Algorithm &algorithm);
|
||||
void setAlgo(const xmrig::Algorithm &algorithm);
|
||||
|
||||
# ifdef APP_DEBUG
|
||||
void print() const;
|
||||
# endif
|
||||
|
||||
private:
|
||||
bool parseIPv6(const char *addr);
|
||||
void adjustVariant(const xmrig::Variant variantHint);
|
||||
|
||||
bool m_nicehash;
|
||||
bool m_tls;
|
||||
int m_keepAlive;
|
||||
uint16_t m_port;
|
||||
xmrig::Algorithm m_algorithm;
|
||||
xmrig::Algorithms m_algorithms;
|
||||
xmrig::c_str m_fingerprint;
|
||||
xmrig::c_str m_host;
|
||||
xmrig::c_str m_password;
|
||||
xmrig::c_str m_rigId;
|
||||
xmrig::c_str m_url;
|
||||
xmrig::c_str m_user;
|
||||
};
|
||||
|
||||
|
||||
typedef std::vector<Pool> Pools;
|
||||
|
||||
#endif /* XMRIG_POOL_H */
|
||||
@@ -5,7 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
@@ -28,7 +29,7 @@
|
||||
#include "common/net/SubmitResult.h"
|
||||
|
||||
|
||||
SubmitResult::SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int64_t reqId) :
|
||||
xmrig::SubmitResult::SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int64_t reqId) :
|
||||
reqId(reqId),
|
||||
seq(seq),
|
||||
diff(diff),
|
||||
@@ -39,7 +40,7 @@ SubmitResult::SubmitResult(int64_t seq, uint32_t diff, uint64_t actualDiff, int6
|
||||
}
|
||||
|
||||
|
||||
void SubmitResult::done()
|
||||
void xmrig::SubmitResult::done()
|
||||
{
|
||||
elapsed = (uv_hrtime() - start) / 1000000;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
@@ -21,13 +22,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SUBMITRESULT_H__
|
||||
#define __SUBMITRESULT_H__
|
||||
#ifndef XMRIG_SUBMITRESULT_H
|
||||
#define XMRIG_SUBMITRESULT_H
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class SubmitResult
|
||||
{
|
||||
public:
|
||||
@@ -46,4 +50,8 @@ private:
|
||||
uint64_t start;
|
||||
};
|
||||
|
||||
#endif /* __SUBMITRESULT_H__ */
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_SUBMITRESULT_H */
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
Client::Tls::Tls(Client *client) :
|
||||
xmrig::Client::Tls::Tls(Client *client) :
|
||||
m_ready(false),
|
||||
m_buf(),
|
||||
m_fingerprint(),
|
||||
@@ -57,7 +57,7 @@ Client::Tls::Tls(Client *client) :
|
||||
}
|
||||
|
||||
|
||||
Client::Tls::~Tls()
|
||||
xmrig::Client::Tls::~Tls()
|
||||
{
|
||||
if (m_ctx) {
|
||||
SSL_CTX_free(m_ctx);
|
||||
@@ -69,7 +69,7 @@ Client::Tls::~Tls()
|
||||
}
|
||||
|
||||
|
||||
bool Client::Tls::handshake()
|
||||
bool xmrig::Client::Tls::handshake()
|
||||
{
|
||||
m_ssl = SSL_new(m_ctx);
|
||||
assert(m_ssl != nullptr);
|
||||
@@ -86,7 +86,7 @@ bool Client::Tls::handshake()
|
||||
}
|
||||
|
||||
|
||||
bool Client::Tls::send(const char *data, size_t size)
|
||||
bool xmrig::Client::Tls::send(const char *data, size_t size)
|
||||
{
|
||||
SSL_write(m_ssl, data, size);
|
||||
|
||||
@@ -94,19 +94,19 @@ bool Client::Tls::send(const char *data, size_t size)
|
||||
}
|
||||
|
||||
|
||||
const char *Client::Tls::fingerprint() const
|
||||
const char *xmrig::Client::Tls::fingerprint() const
|
||||
{
|
||||
return m_ready ? m_fingerprint : nullptr;
|
||||
}
|
||||
|
||||
|
||||
const char *Client::Tls::version() const
|
||||
const char *xmrig::Client::Tls::version() const
|
||||
{
|
||||
return m_ready ? SSL_get_version(m_ssl) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
void Client::Tls::read(const char *data, size_t size)
|
||||
void xmrig::Client::Tls::read(const char *data, size_t size)
|
||||
{
|
||||
BIO_write(m_readBio, data, size);
|
||||
|
||||
@@ -139,13 +139,13 @@ void Client::Tls::read(const char *data, size_t size)
|
||||
}
|
||||
|
||||
|
||||
bool Client::Tls::send()
|
||||
bool xmrig::Client::Tls::send()
|
||||
{
|
||||
return m_client->send(m_writeBio);
|
||||
}
|
||||
|
||||
|
||||
bool Client::Tls::verify(X509 *cert)
|
||||
bool xmrig::Client::Tls::verify(X509 *cert)
|
||||
{
|
||||
if (cert == nullptr) {
|
||||
LOG_ERR("[%s] Failed to get server certificate", m_client->m_pool.url());
|
||||
@@ -169,7 +169,7 @@ bool Client::Tls::verify(X509 *cert)
|
||||
}
|
||||
|
||||
|
||||
bool Client::Tls::verifyFingerprint(X509 *cert)
|
||||
bool xmrig::Client::Tls::verifyFingerprint(X509 *cert)
|
||||
{
|
||||
const EVP_MD *digest = EVP_get_digestbyname("sha256");
|
||||
if (digest == nullptr) {
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 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
|
||||
@@ -31,6 +32,9 @@
|
||||
#include "common/net/Client.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Client::Tls
|
||||
{
|
||||
public:
|
||||
@@ -59,4 +63,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_CLIENT_TLS_H */
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "common/Platform.h"
|
||||
|
||||
|
||||
FailoverStrategy::FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
xmrig::FailoverStrategy::FailoverStrategy(const std::vector<Pool> &pools, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
m_quiet(quiet),
|
||||
m_retries(retries),
|
||||
m_retryPause(retryPause),
|
||||
@@ -37,13 +37,24 @@ FailoverStrategy::FailoverStrategy(const std::vector<Pool> &urls, int retryPause
|
||||
m_index(0),
|
||||
m_listener(listener)
|
||||
{
|
||||
for (const Pool &url : urls) {
|
||||
add(url);
|
||||
for (const Pool &pool : pools) {
|
||||
add(pool);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FailoverStrategy::~FailoverStrategy()
|
||||
xmrig::FailoverStrategy::FailoverStrategy(int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
m_quiet(quiet),
|
||||
m_retries(retries),
|
||||
m_retryPause(retryPause),
|
||||
m_active(-1),
|
||||
m_index(0),
|
||||
m_listener(listener)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
xmrig::FailoverStrategy::~FailoverStrategy()
|
||||
{
|
||||
for (Client *client : m_pools) {
|
||||
client->deleteLater();
|
||||
@@ -51,33 +62,45 @@ FailoverStrategy::~FailoverStrategy()
|
||||
}
|
||||
|
||||
|
||||
int64_t FailoverStrategy::submit(const JobResult &result)
|
||||
void xmrig::FailoverStrategy::add(const Pool &pool)
|
||||
{
|
||||
Client *client = new Client(static_cast<int>(m_pools.size()), Platform::userAgent(), this);
|
||||
client->setPool(pool);
|
||||
client->setRetries(m_retries);
|
||||
client->setRetryPause(m_retryPause * 1000);
|
||||
client->setQuiet(m_quiet);
|
||||
|
||||
m_pools.push_back(client);
|
||||
}
|
||||
|
||||
|
||||
int64_t xmrig::FailoverStrategy::submit(const JobResult &result)
|
||||
{
|
||||
if (m_active == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return m_pools[m_active]->submit(result);
|
||||
return active()->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::connect()
|
||||
void xmrig::FailoverStrategy::connect()
|
||||
{
|
||||
m_pools[m_index]->connect();
|
||||
m_pools[static_cast<size_t>(m_index)]->connect();
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::resume()
|
||||
void xmrig::FailoverStrategy::resume()
|
||||
{
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_listener->onJob(this, m_pools[m_active], m_pools[m_active]->job());
|
||||
m_listener->onJob(this, active(), active()->job());
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
void xmrig::FailoverStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
{
|
||||
for (Client *client : m_pools) {
|
||||
client->setAlgo(algo);
|
||||
@@ -85,7 +108,7 @@ void FailoverStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::stop()
|
||||
void xmrig::FailoverStrategy::stop()
|
||||
{
|
||||
for (size_t i = 0; i < m_pools.size(); ++i) {
|
||||
m_pools[i]->disconnect();
|
||||
@@ -98,7 +121,7 @@ void FailoverStrategy::stop()
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::tick(uint64_t now)
|
||||
void xmrig::FailoverStrategy::tick(uint64_t now)
|
||||
{
|
||||
for (Client *client : m_pools) {
|
||||
client->tick(now);
|
||||
@@ -106,7 +129,7 @@ void FailoverStrategy::tick(uint64_t now)
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onClose(Client *client, int failures)
|
||||
void xmrig::FailoverStrategy::onClose(Client *client, int failures)
|
||||
{
|
||||
if (failures == -1) {
|
||||
return;
|
||||
@@ -121,13 +144,13 @@ void FailoverStrategy::onClose(Client *client, int failures)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_index == client->id() && (m_pools.size() - m_index) > 1) {
|
||||
m_pools[++m_index]->connect();
|
||||
if (m_index == client->id() && (m_pools.size() - static_cast<size_t>(m_index)) > 1) {
|
||||
m_pools[static_cast<size_t>(++m_index)]->connect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onJobReceived(Client *client, const Job &job)
|
||||
void xmrig::FailoverStrategy::onJobReceived(Client *client, const Job &job)
|
||||
{
|
||||
if (m_active == client->id()) {
|
||||
m_listener->onJob(this, client, job);
|
||||
@@ -135,7 +158,7 @@ void FailoverStrategy::onJobReceived(Client *client, const Job &job)
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onLoginSuccess(Client *client)
|
||||
void xmrig::FailoverStrategy::onLoginSuccess(Client *client)
|
||||
{
|
||||
int active = m_active;
|
||||
|
||||
@@ -156,19 +179,7 @@ void FailoverStrategy::onLoginSuccess(Client *client)
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onResultAccepted(Client *client, const SubmitResult &result, const char *error)
|
||||
void xmrig::FailoverStrategy::onResultAccepted(Client *client, const SubmitResult &result, const char *error)
|
||||
{
|
||||
m_listener->onResultAccepted(this, client, result, error);
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::add(const Pool &pool)
|
||||
{
|
||||
Client *client = new Client((int) m_pools.size(), Platform::userAgent(), this);
|
||||
client->setPool(pool);
|
||||
client->setRetries(m_retries);
|
||||
client->setRetryPause(m_retryPause * 1000);
|
||||
client->setQuiet(m_quiet);
|
||||
|
||||
m_pools.push_back(client);
|
||||
}
|
||||
|
||||
@@ -29,29 +29,34 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "base/net/Pool.h"
|
||||
#include "common/interfaces/IClientListener.h"
|
||||
#include "common/interfaces/IStrategy.h"
|
||||
#include "common/net/Pool.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Client;
|
||||
class IStrategyListener;
|
||||
class Url;
|
||||
|
||||
|
||||
class FailoverStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
FailoverStrategy(const std::vector<Pool> &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
FailoverStrategy(int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
~FailoverStrategy() override;
|
||||
|
||||
void add(const Pool &pool);
|
||||
|
||||
public:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void setAlgo(const xmrig::Algorithm &algo) override;
|
||||
void setAlgo(const Algorithm &algo) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
||||
@@ -62,7 +67,7 @@ protected:
|
||||
void onResultAccepted(Client *client, const SubmitResult &result, const char *error) override;
|
||||
|
||||
private:
|
||||
void add(const Pool &pool);
|
||||
inline Client *active() const { return m_pools[static_cast<size_t>(m_active)]; }
|
||||
|
||||
const bool m_quiet;
|
||||
const int m_retries;
|
||||
@@ -73,4 +78,7 @@ private:
|
||||
std::vector<Client*> m_pools;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
#endif /* XMRIG_FAILOVERSTRATEGY_H */
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "common/Platform.h"
|
||||
|
||||
|
||||
SinglePoolStrategy::SinglePoolStrategy(const Pool &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
xmrig::SinglePoolStrategy::SinglePoolStrategy(const Pool &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet) :
|
||||
m_active(false),
|
||||
m_listener(listener)
|
||||
{
|
||||
@@ -41,25 +41,25 @@ SinglePoolStrategy::SinglePoolStrategy(const Pool &pool, int retryPause, int ret
|
||||
}
|
||||
|
||||
|
||||
SinglePoolStrategy::~SinglePoolStrategy()
|
||||
xmrig::SinglePoolStrategy::~SinglePoolStrategy()
|
||||
{
|
||||
m_client->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
int64_t SinglePoolStrategy::submit(const JobResult &result)
|
||||
int64_t xmrig::SinglePoolStrategy::submit(const JobResult &result)
|
||||
{
|
||||
return m_client->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::connect()
|
||||
void xmrig::SinglePoolStrategy::connect()
|
||||
{
|
||||
m_client->connect();
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::resume()
|
||||
void xmrig::SinglePoolStrategy::resume()
|
||||
{
|
||||
if (!isActive()) {
|
||||
return;
|
||||
@@ -69,25 +69,25 @@ void SinglePoolStrategy::resume()
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
void xmrig::SinglePoolStrategy::setAlgo(const xmrig::Algorithm &algo)
|
||||
{
|
||||
m_client->setAlgo(algo);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::stop()
|
||||
void xmrig::SinglePoolStrategy::stop()
|
||||
{
|
||||
m_client->disconnect();
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::tick(uint64_t now)
|
||||
void xmrig::SinglePoolStrategy::tick(uint64_t now)
|
||||
{
|
||||
m_client->tick(now);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onClose(Client *client, int failures)
|
||||
void xmrig::SinglePoolStrategy::onClose(Client *, int)
|
||||
{
|
||||
if (!isActive()) {
|
||||
return;
|
||||
@@ -98,20 +98,20 @@ void SinglePoolStrategy::onClose(Client *client, int failures)
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onJobReceived(Client *client, const Job &job)
|
||||
void xmrig::SinglePoolStrategy::onJobReceived(Client *client, const Job &job)
|
||||
{
|
||||
m_listener->onJob(this, client, job);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onLoginSuccess(Client *client)
|
||||
void xmrig::SinglePoolStrategy::onLoginSuccess(Client *client)
|
||||
{
|
||||
m_active = true;
|
||||
m_listener->onActive(this, client);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onResultAccepted(Client *client, const SubmitResult &result, const char *error)
|
||||
void xmrig::SinglePoolStrategy::onResultAccepted(Client *client, const SubmitResult &result, const char *error)
|
||||
{
|
||||
m_listener->onResultAccepted(this, client, result, error);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "common/interfaces/IStrategy.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Client;
|
||||
class IStrategyListener;
|
||||
class Pool;
|
||||
@@ -47,7 +50,7 @@ public:
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void setAlgo(const xmrig::Algorithm &algo) override;
|
||||
void setAlgo(const Algorithm &algo) override;
|
||||
void stop() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
||||
@@ -63,4 +66,8 @@ private:
|
||||
IStrategyListener *m_listener;
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_SINGLEPOOLSTRATEGY_H */
|
||||
|
||||
Reference in New Issue
Block a user