Added possibility to overrule the PoW
Added PoW adaptions for upcoming AEON PoW changes
This commit is contained in:
parent
353a39dade
commit
77cb5b1196
6 changed files with 53 additions and 28 deletions
|
@ -160,7 +160,8 @@ static struct option const options[] = {
|
|||
{ "user-agent", 1, nullptr, 1008 },
|
||||
{ "userpass", 1, nullptr, 'O' },
|
||||
{ "version", 0, nullptr, 'V' },
|
||||
{ "use-tls", 1, nullptr, 1015 },
|
||||
{ "use-tls", 0, nullptr, 1015 },
|
||||
{ "force-pow-version",1, nullptr, 1016 },
|
||||
{ "api-port", 1, nullptr, 4000 },
|
||||
{ "api-access-token", 1, nullptr, 4001 },
|
||||
{ "api-worker-id", 1, nullptr, 4002 },
|
||||
|
@ -203,6 +204,7 @@ static struct option const config_options[] = {
|
|||
{ "syslog", 0, nullptr, 'S' },
|
||||
{ "threads", 1, nullptr, 't' },
|
||||
{ "user-agent", 1, nullptr, 1008 },
|
||||
{ "force-pow-version", 1, nullptr, 1016 },
|
||||
{ "doublehash-thread-mask", 1, nullptr, 4013 },
|
||||
{ "multihash-thread-mask", 1, nullptr, 4013 },
|
||||
{ nullptr, 0, nullptr, 0 }
|
||||
|
@ -302,6 +304,7 @@ Options::Options(int argc, char **argv) :
|
|||
m_ccKeyFile(nullptr),
|
||||
m_ccCertFile(nullptr),
|
||||
m_algo(ALGO_CRYPTONIGHT),
|
||||
m_forcePowVersion(POW_AUTODETECT),
|
||||
m_algoVariant(AV0_AUTO),
|
||||
m_aesni(AESNI_AUTO),
|
||||
m_hashFactor(0),
|
||||
|
@ -522,11 +525,10 @@ bool Options::parseArg(int key, const char *arg)
|
|||
case 1003: /* --donate-level */
|
||||
case 1004: /* --max-cpu-usage */
|
||||
case 1007: /* --print-time */
|
||||
case 1016: /* --force-pow-version */
|
||||
case 1021: /* --cpu-priority */
|
||||
case 4000: /* --api-port */
|
||||
return parseArg(key, strtol(arg, nullptr, 10));
|
||||
case 4006: /* --cc-port */
|
||||
return parseArg(key, strtol(arg, nullptr, 10));
|
||||
case 4012: /* --cc-update-interval-c */
|
||||
return parseArg(key, strtol(arg, nullptr, 10));
|
||||
|
||||
|
@ -671,6 +673,15 @@ bool Options::parseArg(int key, uint64_t arg)
|
|||
m_printTime = (int) arg;
|
||||
break;
|
||||
|
||||
case 1016: /* --force-pow-version */
|
||||
if (arg < POW_AUTODETECT || arg > POW_V2) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_forcePowVersion = static_cast<PowVersion>(arg);
|
||||
break;
|
||||
|
||||
case 1020: /* --cpu-affinity */
|
||||
if (arg) {
|
||||
m_affinity = arg;
|
||||
|
|
|
@ -61,6 +61,12 @@ public:
|
|||
AESNI_OFF
|
||||
};
|
||||
|
||||
enum PowVersion {
|
||||
POW_AUTODETECT, /* Default, automatic detect by block version */
|
||||
POW_V1, /* Force to use PoW algo before 28.03.2018 */
|
||||
POW_V2, /* Force to use PoW algo used by Monero V7 (after 28.03.2018) and AEON */
|
||||
};
|
||||
|
||||
static inline Options* i() { return m_self; }
|
||||
static Options *parse(int argc, char **argv);
|
||||
|
||||
|
@ -86,19 +92,20 @@ public:
|
|||
inline const char *ccCertFile() const { return m_ccCertFile == nullptr ? "server.pem" : m_ccCertFile; }
|
||||
inline const std::vector<Url*> &pools() const { return m_pools; }
|
||||
inline Algo algo() const { return m_algo; }
|
||||
inline PowVersion forcePowVersion() const { return m_forcePowVersion; }
|
||||
inline bool aesni() const { return m_aesni == AESNI_ON; }
|
||||
inline size_t hashFactor() const { return m_hashFactor; }
|
||||
inline size_t hashFactor() const { return m_hashFactor; }
|
||||
inline int apiPort() const { return m_apiPort; }
|
||||
inline int donateLevel() const { return m_donateLevel; }
|
||||
inline int printTime() const { return m_printTime; }
|
||||
inline int priority() const { return m_priority; }
|
||||
inline int retries() const { return m_retries; }
|
||||
inline int retryPause() const { return m_retryPause; }
|
||||
inline size_t threads() const { return m_threads; }
|
||||
inline size_t threads() const { return m_threads; }
|
||||
inline int ccUpdateInterval() const { return m_ccUpdateInterval; }
|
||||
inline int ccPort() const { return m_ccPort; }
|
||||
inline int64_t affinity() const { return m_affinity; }
|
||||
inline int64_t multiHashThreadMask() const { return m_multiHashThreadMask; }
|
||||
inline int64_t multiHashThreadMask() const { return m_multiHashThreadMask; }
|
||||
inline void setColors(bool colors) { m_colors = colors; }
|
||||
|
||||
inline static void release() { delete m_self; }
|
||||
|
@ -155,6 +162,7 @@ private:
|
|||
Algo m_algo;
|
||||
AlgoVariant m_algoVariant;
|
||||
AesNi m_aesni;
|
||||
PowVersion m_forcePowVersion;
|
||||
size_t m_hashFactor;
|
||||
int m_apiPort;
|
||||
int m_donateLevel;
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
template <size_t NUM_HASH_BLOCKS>
|
||||
static void cryptonight_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) {
|
||||
# if !defined(XMRIG_ARMv7)
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 6) {
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashV7(input, size, output, ctx);
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) {
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
|
||||
} else {
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
}
|
||||
|
@ -46,9 +46,8 @@ static void cryptonight_aesni(const void *input, size_t size, void *output, cryp
|
|||
|
||||
template <size_t NUM_HASH_BLOCKS>
|
||||
static void cryptonight_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) {
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 6)
|
||||
{
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashV7(input, size, output, ctx);
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) {
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
|
||||
} else {
|
||||
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
}
|
||||
|
@ -57,13 +56,21 @@ static void cryptonight_softaes(const void *input, size_t size, void *output, cr
|
|||
template <size_t NUM_HASH_BLOCKS>
|
||||
static void cryptonight_lite_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) {
|
||||
# if !defined(XMRIG_ARMv7)
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) {
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
|
||||
} else {
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
template <size_t NUM_HASH_BLOCKS>
|
||||
static void cryptonight_lite_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) {
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
if (reinterpret_cast<const uint8_t*>(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) {
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
|
||||
} else {
|
||||
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(const void *input, size_t size, void *output, cryptonight_ctx *ctx);
|
||||
|
@ -71,7 +78,6 @@ void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(const void *input, size_t size
|
|||
template <size_t HASH_FACTOR>
|
||||
void setCryptoNightHashMethods(Options::Algo algo, bool aesni)
|
||||
{
|
||||
|
||||
switch (algo) {
|
||||
case Options::ALGO_CRYPTONIGHT:
|
||||
if (aesni) {
|
||||
|
|
|
@ -462,7 +462,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -537,7 +537,7 @@ public:
|
|||
extra_hashes[ctx->state[0][0] & 3](ctx->state[0], 200, static_cast<char*>(output));
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -705,7 +705,7 @@ public:
|
|||
extra_hashes[ctx->state[1][0] & 3](ctx->state[1], 200, static_cast<char*>(output) + 32);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -948,7 +948,7 @@ public:
|
|||
extra_hashes[ctx->state[2][0] & 3](ctx->state[2], 200, static_cast<char*>(output) + 64);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -1266,7 +1266,7 @@ public:
|
|||
extra_hashes[ctx->state[3][0] & 3](ctx->state[3], 200, static_cast<char*>(output) + 96);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -1656,7 +1656,7 @@ public:
|
|||
extra_hashes[ctx->state[4][0] & 3](ctx->state[4], 200, static_cast<char*>(output) + 128);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
|
|
@ -421,7 +421,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -493,7 +493,7 @@ public:
|
|||
extra_hashes[ctx->state[0][0] & 3](ctx->state[0], 200, static_cast<char*>(output));
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -656,7 +656,7 @@ public:
|
|||
extra_hashes[ctx->state[1][0] & 3](ctx->state[1], 200, static_cast<char*>(output) + 32);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -895,7 +895,7 @@ public:
|
|||
extra_hashes[ctx->state[2][0] & 3](ctx->state[2], 200, static_cast<char*>(output) + 64);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -1209,7 +1209,7 @@ public:
|
|||
extra_hashes[ctx->state[3][0] & 3](ctx->state[3], 200, static_cast<char*>(output) + 96);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
@ -1595,7 +1595,7 @@ public:
|
|||
extra_hashes[ctx->state[4][0] & 3](ctx->state[4], 200, static_cast<char*>(output) + 128);
|
||||
}
|
||||
|
||||
inline static void hashV7(const void* __restrict__ input,
|
||||
inline static void hashPowV2(const void* __restrict__ input,
|
||||
size_t size,
|
||||
void* __restrict__ output,
|
||||
cryptonight_ctx* __restrict__ ctx)
|
||||
|
|
|
@ -50,9 +50,9 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
|
|||
Job::toHex(hash, 32, userId);
|
||||
|
||||
#ifndef XMRIG_NO_TLS
|
||||
Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 8081, userId, nullptr, true, false, true);
|
||||
Url *url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8081 : 443, userId, nullptr, true, false, true);
|
||||
#else
|
||||
Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 80 : 443, userId, nullptr, false, false, true);
|
||||
Url *url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 80, userId, nullptr, false, false, true);
|
||||
#endif
|
||||
|
||||
m_client = new Client(-1, agent, this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue