1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-08 08:23:34 -05:00

Compare commits

..

17 Commits

Author SHA1 Message Date
XMRig
9f4e1ee373 Update version. 2017-07-14 21:26:22 +03:00
xmrig
ff0c6b6365 Update CHANGELOG.md 2017-07-14 21:22:48 +03:00
XMRig
7397efaf6d Merge branch 'master' of github.com:xmrig/xmrig 2017-07-14 21:16:05 +03:00
XMRig
aadc15ce66 Ignore duplicated job received from pool, with warning message. 2017-07-14 21:06:08 +03:00
XMRig
ad7c925a1a Merge branch 'dev' 2017-07-14 20:54:32 +03:00
XMRig
57be6f94bb Small code cleanup. 2017-07-13 18:02:48 +03:00
xmrig
35b188762c Update README.md 2017-07-12 14:02:07 +03:00
XMRig
7c6e429854 Improved pause/resume mechanism. 2017-07-10 21:42:28 +03:00
XMRig
c15aefd968 Merge branch 'master' into dev 2017-07-10 18:53:39 +03:00
XMRig
4a712354f1 #28 Fixed Alpine Linux support. 2017-07-07 07:15:58 +03:00
xmrig
4545c84a11 Update CHANGELOG.md 2017-07-06 10:05:36 +03:00
XMRig
a66297bed8 Merge branch 'master' into dev 2017-07-06 09:36:16 +03:00
XMRig
f4dadfd90b Improve nicehash detection. 2017-07-05 07:54:21 +03:00
XMRig
955134b162 #27 Fix possibility crash on 32bit. 2017-07-05 07:20:28 +03:00
XMRig
68795137da Merge branch 'master' into dev 2017-07-04 14:56:40 +03:00
XMRig
6ed2d61586 Probably fix OS X support. 2017-07-03 11:02:32 +03:00
xmrig
a96782218f Update README.md 2017-07-03 07:24:56 +03:00
15 changed files with 73 additions and 20 deletions

View File

@@ -1,3 +1,10 @@
# v2.0.2
- Better deal with possible duplicate jobs from pool, show warning and ignore duplicates.
- For Windows builds libuv updated to version 1.13.1 and gcc to 7.1.0.
# v2.0.1
- [#27](https://github.com/xmrig/xmrig/issues/27) Fixed possibility crash on 32bit systems.
# v2.0.0
- Option `--backup-url` removed, instead now possibility specify multiple pools for example: `-o example1.com:3333 -u user1 -p password1 -k -o example2.com:5555 -u user2 -o example3.com:4444 -u user3`
- [#15](https://github.com/xmrig/xmrig/issues/15) Added option `-l, --log-file=FILE` to write log to file.

View File

@@ -1,8 +1,8 @@
# XMRig
XMRig is high performance Monero (XMR) CPU miner, with the official full Windows support.
Based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of legacy code.
Originally based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of legacy code, since version 1.0.0 complete rewritten from scratch on C++.
<img src="http://i.imgur.com/GdRDnAu.png" width="596" >
<img src="https://i.imgur.com/OXoB10D.png" width="628" >
#### Table of contents
* [Features](#features)

View File

@@ -40,6 +40,6 @@ void Cpu::init()
}
void Cpu::setAffinity(int id, unsigned long mask)
void Cpu::setAffinity(int id, uint64_t mask)
{
}

View File

@@ -25,6 +25,7 @@
#include <pthread.h>
#include <sched.h>
#include <unistd.h>
#include <string.h>
#include "Cpu.h"

View File

@@ -52,12 +52,13 @@ Client::Client(int id, const char *agent, IClientListener *listener) :
m_socket(nullptr)
{
memset(m_ip, 0, sizeof(m_ip));
memset(&m_hints, 0, sizeof(m_hints));
m_resolver.data = m_responseTimer.data = m_retriesTimer.data = m_keepAliveTimer.data = this;
m_hints.ai_family = PF_INET;
m_hints.ai_socktype = SOCK_STREAM;
m_hints.ai_protocol = IPPROTO_TCP;
m_hints.ai_flags = 0;
m_recvBuf.base = static_cast<char*>(malloc(kRecvBufSize));
m_recvBuf.len = kRecvBufSize;
@@ -184,6 +185,11 @@ bool Client::parseJob(const json_t *params, int *code)
return false;
}
if (m_job == job) {
LOG_WARN("[%s:%u] duplicate job received, ignore", m_url.host(), m_url.port());
return false;
}
m_job = std::move(job);
LOG_DEBUG("[%s:%u] job: \"%s\", diff: %lld", m_url.host(), m_url.port(), job.id(), job.diff());
@@ -533,9 +539,3 @@ void Client::onResolved(uv_getaddrinfo_t *req, int status, struct addrinfo *res)
client->connect(res->ai_addr);
uv_freeaddrinfo(res);
}
Client *Client::getClient(void *data)
{
return static_cast<Client*>(data);
}

View File

@@ -96,7 +96,7 @@ private:
static void onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf);
static void onResolved(uv_getaddrinfo_t *req, int status, struct addrinfo *res);
static Client *getClient(void *data);
static inline Client *getClient(void *data) { return static_cast<Client*>(data); }
bool m_quiet;
char m_ip[17];

View File

@@ -82,7 +82,15 @@ bool Job::setBlob(const char *blob)
return false;
}
return fromHex(blob, m_size * 2, m_blob);
if (!fromHex(blob, m_size * 2, m_blob)) {
return false;
}
if (*nonce() != 0 && !m_nicehash) {
m_nicehash = true;
}
return true;
}
@@ -156,3 +164,9 @@ void Job::toHex(const unsigned char* in, unsigned int len, char* out)
out[i * 2 + 1] = hf_bin2hex(in[i] & 0x0F);
}
}
bool Job::operator==(const Job &other) const
{
return memcmp(m_id, other.m_id, sizeof(m_id)) == 0;
}

View File

@@ -55,6 +55,8 @@ public:
static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; }
static void toHex(const unsigned char* in, unsigned int len, char* out);
bool operator==(const Job &other) const;
private:
bool m_nicehash;
int m_poolId;

View File

@@ -29,7 +29,6 @@
#include <uv.h>
#include "interfaces/IClientListener.h"
#include "interfaces/IJobResultListener.h"
#include "interfaces/IStrategyListener.h"
@@ -57,10 +56,7 @@ protected:
void onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error) override;
private:
void addPool(const Url *url);
void setJob(Client *client, const Job &job);
void startDonate();
void stopDonate();
bool m_donateActive;
char *m_agent;

View File

@@ -34,7 +34,7 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
m_idleTime((100 - Options::i()->donateLevel()) * 60 * 1000),
m_listener(listener)
{
Url *url = new Url("donate.xmrig.com", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 3333 : 443, Options::i()->pools().front()->user());
Url *url = new Url("donate2.xmrig.com", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 3333 : 443, Options::i()->pools().front()->user());
m_client = new Client(-1, agent, this);
m_client->setUrl(url);

View File

@@ -27,14 +27,14 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "Monero (XMR) CPU miner"
#define APP_VERSION "2.0.0"
#define APP_VERSION "2.0.2"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
#define APP_VER_MAJOR 2
#define APP_VER_MINOR 0
#define APP_VER_BUILD 0
#define APP_VER_BUILD 2
#define APP_VER_REV 0
#ifdef _MSC_VER

View File

@@ -114,6 +114,9 @@ void DoubleWorker::consumeJob()
{
Job job = Workers::job();
m_sequence = Workers::sequence();
if (m_state->job == job) {
return;
}
save(job);

View File

@@ -85,6 +85,9 @@ void SingleWorker::consumeJob()
{
Job job = Workers::job();
m_sequence = Workers::sequence();
if (m_job == job) {
return;
}
save(job);

View File

@@ -34,6 +34,8 @@
#include "workers/Workers.h"
bool Workers::m_active = false;
bool Workers::m_enabled = true;
Hashrate *Workers::m_hashrate = nullptr;
IJobResultListener *Workers::m_listener = nullptr;
Job Workers::m_job;
@@ -58,12 +60,33 @@ Job Workers::job()
}
void Workers::setEnabled(bool enabled)
{
if (m_enabled == enabled) {
return;
}
m_enabled = enabled;
if (!m_active) {
return;
}
m_paused = enabled ? 0 : 1;
m_sequence++;
}
void Workers::setJob(const Job &job)
{
uv_rwlock_wrlock(&m_rwlock);
m_job = job;
uv_rwlock_wrunlock(&m_rwlock);
m_active = true;
if (!m_enabled) {
return;
}
m_sequence++;
m_paused = 0;
}

View File

@@ -43,14 +43,16 @@ class Workers
{
public:
static Job job();
static void setEnabled(bool enabled);
static void setJob(const Job &job);
static void start(int64_t affinity);
static void submit(const JobResult &result);
static inline bool isEnabled() { return m_enabled; }
static inline bool isOutdated(uint64_t sequence) { return m_sequence.load(std::memory_order_relaxed) != sequence; }
static inline bool isPaused() { return m_paused.load(std::memory_order_relaxed) == 1; }
static inline uint64_t sequence() { return m_sequence.load(std::memory_order_relaxed); }
static inline void pause() { m_paused = 1; m_sequence++; }
static inline void pause() { m_active = false; m_paused = 1; m_sequence++; }
static inline void setListener(IJobResultListener *listener) { m_listener = listener; }
private:
@@ -58,6 +60,8 @@ private:
static void onResult(uv_async_t *handle);
static void onTick(uv_timer_t *handle);
static bool m_active;
static bool m_enabled;
static Hashrate *m_hashrate;
static IJobResultListener *m_listener;
static Job m_job;