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

Compare commits

...

15 Commits

Author SHA1 Message Date
xmrig
30903686bd Update README.md 2018-04-10 00:30:06 +07:00
XMRig
82e1138158 v2.6.0-beta2 2018-04-09 23:50:01 +07:00
XMRig
ccbb78d4e9 Improved performance for cryptonight v7. 2018-04-09 21:56:15 +07:00
XMRig
5b664f3681 Fix nonce calculation for --av 4. 2018-04-09 21:21:46 +07:00
XMRig
77207eaaae Fix build with APP_DEBUG. 2018-04-09 20:38:02 +07:00
XMRig
de83cfd53c #519 Fix donation start time randomization. 2018-04-08 22:19:21 +07:00
XMRig
eb56c2b56e Better implementation for algorithm aliases. 2018-04-08 03:20:44 +07:00
XMRig
bb2faaddc0 Added short aliases for algorithm names: cn, cn-lite and cn-heavy. 2018-04-08 02:44:31 +07:00
xmrig
89c095f79e Update CHANGELOG.md 2018-04-07 01:21:56 +07:00
XMRig
dff7636701 Merge branch 'dev' of github.com:xmrig/xmrig into dev 2018-04-07 01:18:22 +07:00
XMRig
3b83fa530c #499 Disabled IPv6 for internal HTTP API by default, was cause issues on some systems. 2018-04-07 01:17:58 +07:00
xmrig
bca087f111 Update CHANGELOG.md 2018-04-07 00:50:24 +07:00
XMRig
ae647699a4 #502 Fixed build without libmicrohttpd. 2018-04-07 00:44:48 +07:00
XMRig
3a67ee6d11 Small fixes. 2018-04-06 23:32:54 +07:00
XMRig
c227e3c7b4 Fix command line option --donate-level. 2018-04-04 00:10:53 +07:00
13 changed files with 104 additions and 44 deletions

View File

@@ -1,3 +1,12 @@
# v2.6.0-beta2
- Improved performance for `cryptonight v7` especially in double hash mode.
- [#499](https://github.com/xmrig/xmrig/issues/499) IPv6 disabled for internal HTTP API by default, was cause issues on some systems.
- Added short aliases for algorithm names: `cn`, `cn-lite` and `cn-heavy`.
- Fixed regressions (v2.6.0-beta1 affected)
- [#494](https://github.com/xmrig/xmrig/issues/494) Command line option `--donate-level` was broken.
- [#502](https://github.com/xmrig/xmrig/issues/502) Build without libmicrohttpd was broken.
- Fixed nonce calculation for `--av 4` (software AES, double hash) was cause reduction of effective hashrate and rejected shares on nicehash.
# v2.6.0-beta1 # v2.6.0-beta1
- [#476](https://github.com/xmrig/xmrig/issues/476) **Added Cryptonight-Heavy support for Sumokoin ASIC resistance fork.** - [#476](https://github.com/xmrig/xmrig/issues/476) **Added Cryptonight-Heavy support for Sumokoin ASIC resistance fork.**
- HTTP server now runs in main loop, it make possible easy extend API without worry about thread synchronization. - HTTP server now runs in main loop, it make possible easy extend API without worry about thread synchronization.

View File

@@ -12,7 +12,6 @@ include (cmake/cpu.cmake)
set(HEADERS set(HEADERS
src/api/Api.h
src/api/NetworkState.h src/api/NetworkState.h
src/App.h src/App.h
src/Console.h src/Console.h
@@ -87,7 +86,6 @@ else()
endif() endif()
set(SOURCES set(SOURCES
src/api/Api.cpp
src/api/NetworkState.cpp src/api/NetworkState.cpp
src/App.cpp src/App.cpp
src/Console.cpp src/Console.cpp
@@ -214,11 +212,13 @@ if (WITH_HTTPD)
if (MHD_FOUND) if (MHD_FOUND)
include_directories(${MHD_INCLUDE_DIRS}) include_directories(${MHD_INCLUDE_DIRS})
set(HTTPD_SOURCES set(HTTPD_SOURCES
src/api/Api.h
src/api/ApiRouter.h src/api/ApiRouter.h
src/api/HttpBody.h src/api/HttpBody.h
src/api/Httpd.h src/api/Httpd.h
src/api/HttpReply.h src/api/HttpReply.h
src/api/HttpRequest.h src/api/HttpRequest.h
src/api/Api.cpp
src/api/ApiRouter.cpp src/api/ApiRouter.cpp
src/api/Httpd.cpp src/api/Httpd.cpp
src/api/HttpRequest.cpp src/api/HttpRequest.cpp

View File

@@ -124,10 +124,10 @@ Please note performance is highly dependent on system load. The numbers above ar
## Release checksums ## Release checksums
### SHA-256 ### SHA-256
``` ```
bd14bc3cfd9528e4a7583ab39aecc876250333e1e0faab83781584bb7f65e3eb xmrig-2.6.0-beta1-xenial-amd64.tar.gz/xmrig-2.6.0-beta1/xmrig 232af0c5f3b1cdbc2d90b514873a764b434d5621d2790da67954b35c17e44fe3 xmrig-2.6.0-beta2-xenial-amd64.tar.gz/xmrig-2.6.0-beta2/xmrig
32eebf71e5631029202ae5cbf6f03caad912f1722aa86a1be01a26d491801aba xmrig-2.6.0-beta1-gcc-win32.zip/xmrig.exe 2366a06729d4de538ef511862bf11d0c7ad40fd245e7aeab3c1957307d63471a xmrig-2.6.0-beta2-gcc-win32.zip/xmrig.exe
1cc08844ff019408e2e2c9560fee0c4e0b2dbc2a72bcc1c1da4a847a1787eca3 xmrig-2.6.0-beta1-gcc-win64.zip/xmrig.exe 2f6538c765e001d13ca380cbc1558d51efcb97d4bccdfa40993cb872be4e9efd xmrig-2.6.0-beta2-gcc-win64.zip/xmrig.exe
fdf99aa8e7792a34b1be0cc6c77e4e83ff9a4b21abb27989f7927dcfed82f6e2 xmrig-2.6.0-beta1-msvc-win64.zip/xmrig.exe 3c0479acb78a3cee8fe416ee438dbff09c786acf50fbaf28a820127fcd0c6e62 xmrig-2.6.0-beta2-msvc-win64.zip/xmrig.exe
``` ```
## Contacts ## Contacts

View File

@@ -123,7 +123,7 @@ static void print_pools(xmrig::Config *config)
# ifdef APP_DEBUG # ifdef APP_DEBUG
for (size_t i = 0; i < pools.size(); ++i) { for (size_t i = 0; i < pools.size(); ++i) {
Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->isKeepAlive(), pools[i]->isNicehash()); Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->keepAlive(), pools[i]->isNicehash());
} }
# endif # endif
} }

View File

@@ -27,6 +27,8 @@
"api": { "api": {
"port": 0, // port for the miner API https://github.com/xmrig/xmrig/wiki/API "port": 0, // port for the miner API https://github.com/xmrig/xmrig/wiki/API
"access-token": null, // access token for API "access-token": null, // access token for API
"worker-id": null // custom worker-id for API "worker-id": null, // custom worker-id for API
"ipv6": false,
"restricted": true
} }
} }

View File

@@ -22,6 +22,7 @@
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -45,6 +46,13 @@ static const char *algoNames[] = {
}; };
static const char *algoNamesShort[] = {
"cn",
"cn-lite",
"cn-heavy"
};
#if defined(_WIN32) && !defined(strcasecmp) #if defined(_WIN32) && !defined(strcasecmp)
# define strcasecmp _stricmp # define strcasecmp _stricmp
#endif #endif
@@ -53,12 +61,18 @@ static const char *algoNames[] = {
xmrig::CommonConfig::CommonConfig() : xmrig::CommonConfig::CommonConfig() :
m_algorithm(CRYPTONIGHT), m_algorithm(CRYPTONIGHT),
m_adjusted(false), m_adjusted(false),
m_apiIPv6(true), m_apiIPv6(false),
m_apiRestricted(true), m_apiRestricted(true),
m_background(false), m_background(false),
m_colors(true), m_colors(true),
m_syslog(false), m_syslog(false),
# ifdef XMRIG_PROXY_PROJECT
m_watch(true),
# else
m_watch(false), // TODO: enable config file watch by default when this feature propertly handled and tested. m_watch(false), // TODO: enable config file watch by default when this feature propertly handled and tested.
# endif
m_apiToken(nullptr), m_apiToken(nullptr),
m_apiWorkerId(nullptr), m_apiWorkerId(nullptr),
m_fileName(nullptr), m_fileName(nullptr),
@@ -247,16 +261,14 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
case ApiIPv6Key: /* --api-no-ipv6 */ case ApiIPv6Key: /* --api-no-ipv6 */
return parseBoolean(key, false); return parseBoolean(key, false);
# ifdef XMRIG_PROXY_PROJECT case DonateLevelKey: /* --donate-level */
case 1003: /* --donate-level */ # ifdef XMRIG_PROXY_PROJECT
if (strncmp(arg, "minemonero.pro", 14) == 0) { if (strncmp(arg, "minemonero.pro", 14) == 0) {
m_donateLevel = 0; m_donateLevel = 0;
return true;
} }
else { # endif
parseUint64(key, strtol(arg, nullptr, 10)); return parseUint64(key, strtol(arg, nullptr, 10));
}
break;
# endif
default: default:
break; break;
@@ -337,7 +349,7 @@ bool xmrig::CommonConfig::parseInt(int key, int arg)
break; break;
case DonateLevelKey: /* --donate-level */ case DonateLevelKey: /* --donate-level */
if (arg >= kMinDonateLevel && arg <= 99) { if (arg >= kMinimumDonateLevel && arg <= 99) {
m_donateLevel = arg; m_donateLevel = arg;
} }
break; break;
@@ -371,10 +383,12 @@ void xmrig::CommonConfig::setAlgo(const char *algo)
return; return;
} }
const size_t size = sizeof(algoNames) / sizeof((algoNames)[0]); const size_t size = sizeof(algoNames) / sizeof(algoNames[0]);
assert(size == (sizeof(algoNamesShort) / sizeof(algoNamesShort[0])));
for (size_t i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
if (algoNames[i] && strcasecmp(algo, algoNames[i]) == 0) { if (strcasecmp(algo, algoNames[i]) == 0 || strcasecmp(algo, algoNamesShort[i]) == 0) {
m_algorithm = static_cast<Algo>(i); m_algorithm = static_cast<Algo>(i);
break; break;
} }

View File

@@ -66,6 +66,8 @@ inline size_t cn_select_memory(Algo algorithm)
case CRYPTONIGHT_HEAVY: case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_MEMORY; return CRYPTONIGHT_HEAVY_MEMORY;
} }
return 0;
} }
@@ -87,6 +89,8 @@ inline uint32_t cn_select_mask(Algo algorithm)
case CRYPTONIGHT_HEAVY: case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_MASK; return CRYPTONIGHT_HEAVY_MASK;
} }
return 0;
} }
@@ -108,6 +112,8 @@ inline uint32_t cn_select_iter(Algo algorithm)
case CRYPTONIGHT_HEAVY: case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_ITER; return CRYPTONIGHT_HEAVY_ITER;
} }
return 0;
} }

View File

@@ -386,6 +386,22 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
} }
static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp)
{
mem_out[0] = EXTRACT64(tmp);
tmp = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(tmp), _mm_castsi128_ps(tmp)));
uint64_t vh = EXTRACT64(tmp);
uint8_t x = vh >> 24;
static const uint16_t table = 0x7531;
const uint8_t index = (((x >> 3) & 6) | (x & 1)) << 1;
vh ^= ((table >> index) & 0x3) << 28;
mem_out[1] = vh;
}
template<xmrig::Algo ALGO, bool SOFT_AES, int VARIANT> template<xmrig::Algo ALGO, bool SOFT_AES, int VARIANT>
inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx *__restrict__ ctx) inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx *__restrict__ ctx)
{ {
@@ -400,7 +416,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
keccak(input, (int) size, ctx->state0, 200); keccak(input, (int) size, ctx->state0, 200);
VARIANT1_INIT(0); VARIANT1_INIT(0)
cn_explode_scratchpad<ALGO, MEM, SOFT_AES>((__m128i*) ctx->state0, (__m128i*) ctx->memory); cn_explode_scratchpad<ALGO, MEM, SOFT_AES>((__m128i*) ctx->state0, (__m128i*) ctx->memory);
@@ -423,8 +439,13 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]); cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
cx = _mm_aesenc_si128(cx, _mm_set_epi64x(ah0, al0)); cx = _mm_aesenc_si128(cx, _mm_set_epi64x(ah0, al0));
} }
_mm_store_si128((__m128i *) &l0[idx0 & MASK], _mm_xor_si128(bx0, cx));
VARIANT1_1(&l0[idx0 & MASK]); if (VARIANT > 0) {
cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx));
} else {
_mm_store_si128((__m128i *)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx));
}
idx0 = EXTRACT64(cx); idx0 = EXTRACT64(cx);
bx0 = cx; bx0 = cx;
@@ -513,10 +534,13 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
cx1 = _mm_aesenc_si128(cx1, _mm_set_epi64x(ah1, al1)); cx1 = _mm_aesenc_si128(cx1, _mm_set_epi64x(ah1, al1));
} }
_mm_store_si128((__m128i *) &l0[idx0 & MASK], _mm_xor_si128(bx0, cx0)); if (VARIANT > 0) {
_mm_store_si128((__m128i *) &l1[idx1 & MASK], _mm_xor_si128(bx1, cx1)); cryptonight_monero_tweak((uint64_t*)&l0[idx0 & MASK], _mm_xor_si128(bx0, cx0));
VARIANT1_1(&l0[idx0 & MASK]); cryptonight_monero_tweak((uint64_t*)&l1[idx1 & MASK], _mm_xor_si128(bx1, cx1));
VARIANT1_1(&l1[idx1 & MASK]); } else {
_mm_store_si128((__m128i *) &l0[idx0 & MASK], _mm_xor_si128(bx0, cx0));
_mm_store_si128((__m128i *) &l1[idx1 & MASK], _mm_xor_si128(bx1, cx1));
}
idx0 = EXTRACT64(cx0); idx0 = EXTRACT64(cx0);
idx1 = EXTRACT64(cx1); idx1 = EXTRACT64(cx1);

View File

@@ -29,9 +29,14 @@
* Dev donation. * Dev donation.
* *
* Percentage of your hashing power that you want to donate to the developer, can be 0 if you don't want to do that. * Percentage of your hashing power that you want to donate to the developer, can be 0 if you don't want to do that.
* Example of how it works for the default setting of 1: *
* You miner will mine into your usual pool for 99 minutes, then switch to the developer's pool for 1 minute. * Example of how it works for the setting of 1%:
* Since v2.5.1 start time randomized in range from 50 to 150 minutes minus donation time. * You miner will mine into your usual pool for random time (in range from 49.5 to 148.5 minutes),
* then switch to the developer's pool for 1 minute, then switch again to your pool for 99 minutes
* and then switch agaiin to developer's pool for 1 minute, these rounds will continue until miner working.
*
* Randomised only first round, to prevent waves on the donation pool.
*
* Switching is instant, and only happens after a successful connection, so you never loose any hashes. * Switching is instant, and only happens after a successful connection, so you never loose any hashes.
* *
* If you plan on changing this setting to 0 please consider making a one off donation to my wallet: * If you plan on changing this setting to 0 please consider making a one off donation to my wallet:
@@ -39,7 +44,7 @@
* BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT * BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
*/ */
constexpr const int kDefaultDonateLevel = 5; constexpr const int kDefaultDonateLevel = 5;
constexpr const int kMinDonateLevel = 1; constexpr const int kMinimumDonateLevel = 1;
#endif /* __DONATE_H__ */ #endif /* __DONATE_H__ */

View File

@@ -41,8 +41,8 @@ const static char *kDonatePool1 = "miner.fee.xmrig.com";
const static char *kDonatePool2 = "emergency.fee.xmrig.com"; const static char *kDonatePool2 = "emergency.fee.xmrig.com";
static inline int random(int min, int max){ static inline float randomf(float min, float max) {
return min + rand() / (RAND_MAX / (max - min + 1) + 1); return (max - min) * ((((float) rand()) / (float) RAND_MAX)) + min;
} }
@@ -78,7 +78,7 @@ DonateStrategy::DonateStrategy(int level, const char *user, int algo, IStrategyL
m_timer.data = this; m_timer.data = this;
uv_timer_init(uv_default_loop(), &m_timer); uv_timer_init(uv_default_loop(), &m_timer);
idle(random(3000, 9000) * 1000 - m_donateTime); idle(m_idleTime * randomf(0.5, 1.5));
} }

View File

@@ -27,7 +27,7 @@
#define APP_ID "xmrig" #define APP_ID "xmrig"
#define APP_NAME "XMRig" #define APP_NAME "XMRig"
#define APP_DESC "XMRig CPU miner" #define APP_DESC "XMRig CPU miner"
#define APP_VERSION "2.6.0-beta1" #define APP_VERSION "2.6.0-beta2"
#define APP_DOMAIN "xmrig.com" #define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com" #define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com"
@@ -36,7 +36,7 @@
#define APP_VER_MAJOR 2 #define APP_VER_MAJOR 2
#define APP_VER_MINOR 6 #define APP_VER_MINOR 6
#define APP_VER_BUILD 0 #define APP_VER_BUILD 0
#define APP_VER_REV 1 #define APP_VER_REV 2
#ifdef _MSC_VER #ifdef _MSC_VER
# if (_MSC_VER >= 1910) # if (_MSC_VER >= 1910)

View File

@@ -146,28 +146,28 @@ xmrig::CpuThread *xmrig::CpuThread::createFromAV(size_t index, Algo algorithm, A
softAES = true; softAES = true;
break; break;
case AV_DOUBLE:
multiway = DoubleWay;
case AV_DOUBLE_SOFT: case AV_DOUBLE_SOFT:
softAES = true; softAES = true;
case AV_DOUBLE:
multiway = DoubleWay;
break; break;
case AV_TRIPLE:
multiway = TripleWay;
case AV_TRIPLE_SOFT: case AV_TRIPLE_SOFT:
softAES = true; softAES = true;
case AV_TRIPLE:
multiway = TripleWay;
break; break;
case AV_QUAD:
multiway = QuadWay;
case AV_QUAD_SOFT: case AV_QUAD_SOFT:
softAES = true; softAES = true;
case AV_QUAD:
multiway = QuadWay;
break; break;
case AV_PENTA:
multiway = PentaWay;
case AV_PENTA_SOFT: case AV_PENTA_SOFT:
softAES = true; softAES = true;
case AV_PENTA:
multiway = PentaWay;
break; break;
default: default:

View File

@@ -116,7 +116,7 @@ bool SingleWorker::selfTest()
} }
# endif # endif
return memcmp(m_result.result, test_output_heavy, 32) == 0; return m_thread->algorithm() == xmrig::CRYPTONIGHT_HEAVY && memcmp(m_result.result, test_output_heavy, 32) == 0;
} }