From 67863a427d2443f45842f9ac3df6f312e31456f7 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 13 Jan 2019 19:42:27 +0700 Subject: [PATCH] Rename "cn/xtlv9" to "cn/half". --- src/common/crypto/Algorithm.cpp | 11 ++++++++--- src/common/net/Client.cpp | 3 +-- src/common/net/Job.cpp | 5 ++++- src/common/net/Pool.cpp | 2 +- src/common/xmrig.h | 2 +- src/crypto/CryptoNight_constants.h | 17 +++++++---------- src/crypto/CryptoNight_test.h | 4 ++-- src/workers/CpuThread.cpp | 20 ++++++++++---------- src/workers/MultiWorker.cpp | 2 +- 9 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/common/crypto/Algorithm.cpp b/src/common/crypto/Algorithm.cpp index d8131ceb..909c772a 100644 --- a/src/common/crypto/Algorithm.cpp +++ b/src/common/crypto/Algorithm.cpp @@ -62,7 +62,8 @@ static AlgoData const algorithms[] = { { "cryptonight/xao", "cn/xao", xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO }, { "cryptonight/rto", "cn/rto", xmrig::CRYPTONIGHT, xmrig::VARIANT_RTO }, { "cryptonight/2", "cn/2", xmrig::CRYPTONIGHT, xmrig::VARIANT_2 }, - { "cryptonight/xtlv9", "cn/xtlv9", xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL2 }, + { "cryptonight/half", "cn/half", xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF }, + { "cryptonight/xtlv9", "cn/xtlv9", xmrig::CRYPTONIGHT, xmrig::VARIANT_HALF }, # ifndef XMRIG_NO_AEON { "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO }, @@ -110,7 +111,7 @@ static const char *variants[] = { "xao", "rto", "2", - "xtlv9" + "half" }; @@ -174,9 +175,13 @@ void xmrig::Algorithm::parseVariant(const char *variant) for (size_t i = 0; i < ARRAY_SIZE(variants); i++) { if (strcasecmp(variant, variants[i]) == 0) { m_variant = static_cast(i); - break; + return; } } + + if (strcasecmp(variant, "xtlv9") == 0) { + m_variant = VARIANT_HALF; + } } diff --git a/src/common/net/Client.cpp b/src/common/net/Client.cpp index 8458b1e2..6da63942 100644 --- a/src/common/net/Client.cpp +++ b/src/common/net/Client.cpp @@ -342,8 +342,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code) if (params.HasMember("algo")) { job.setAlgorithm(params["algo"].GetString()); } - - if (params.HasMember("variant")) { + else if (params.HasMember("variant")) { const rapidjson::Value &variant = params["variant"]; if (variant.IsInt()) { diff --git a/src/common/net/Job.cpp b/src/common/net/Job.cpp index a0108d6a..2eb84f18 100644 --- a/src/common/net/Job.cpp +++ b/src/common/net/Job.cpp @@ -125,7 +125,10 @@ bool Job::setBlob(const char *blob) m_algorithm.setVariant(variant()); } else if (m_algorithm.variant() == xmrig::VARIANT_XTL && m_blob[0] >= 9) { - m_algorithm.setVariant(xmrig::VARIANT_XTL2); + m_algorithm.setVariant(xmrig::VARIANT_HALF); + } + else if (m_algorithm.variant() == xmrig::VARIANT_MSR && m_blob[0] >= 8) { + m_algorithm.setVariant(xmrig::VARIANT_HALF); } # ifdef XMRIG_PROXY_PROJECT diff --git a/src/common/net/Pool.cpp b/src/common/net/Pool.cpp index 617a03b9..a44f8a41 100644 --- a/src/common/net/Pool.cpp +++ b/src/common/net/Pool.cpp @@ -412,7 +412,7 @@ void Pool::rebuild() addVariant(xmrig::VARIANT_2); addVariant(xmrig::VARIANT_1); addVariant(xmrig::VARIANT_0); - addVariant(xmrig::VARIANT_XTL2); + addVariant(xmrig::VARIANT_HALF); addVariant(xmrig::VARIANT_XTL); addVariant(xmrig::VARIANT_TUBE); addVariant(xmrig::VARIANT_MSR); diff --git a/src/common/xmrig.h b/src/common/xmrig.h index b60c4bd7..883d866d 100644 --- a/src/common/xmrig.h +++ b/src/common/xmrig.h @@ -69,7 +69,7 @@ enum Variant { VARIANT_XAO = 6, // Modified CryptoNight variant 0 (Alloy only) VARIANT_RTO = 7, // Modified CryptoNight variant 1 (Arto only) VARIANT_2 = 8, // CryptoNight variant 2 - VARIANT_XTL2 = 9, + VARIANT_HALF = 9, // CryptoNight variant 2 with half iterations (Masari/Stellite) VARIANT_MAX }; diff --git a/src/crypto/CryptoNight_constants.h b/src/crypto/CryptoNight_constants.h index 74f725ee..f0032305 100644 --- a/src/crypto/CryptoNight_constants.h +++ b/src/crypto/CryptoNight_constants.h @@ -6,7 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2018 Lee Clagett - * Copyright 2016-2018 XMRig , + * Copyright 2016-2019 XMRig , * * 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 @@ -38,9 +38,8 @@ namespace xmrig constexpr const size_t CRYPTONIGHT_MEMORY = 2 * 1024 * 1024; constexpr const uint32_t CRYPTONIGHT_MASK = 0x1FFFF0; constexpr const uint32_t CRYPTONIGHT_ITER = 0x80000; -constexpr const uint32_t CRYPTONIGHT_MSR_ITER = 0x40000; +constexpr const uint32_t CRYPTONIGHT_HALF_ITER = 0x40000; constexpr const uint32_t CRYPTONIGHT_XAO_ITER = 0x100000; -constexpr const uint32_t CRYPTONIGHT_XTL2_ITER = 0x40000; constexpr const size_t CRYPTONIGHT_LITE_MEMORY = 1 * 1024 * 1024; constexpr const uint32_t CRYPTONIGHT_LITE_MASK = 0xFFFF0; @@ -110,8 +109,8 @@ template<> inline constexpr uint32_t cn_select_iter() template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_ITER; } -template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_XTL2_ITER; } -template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_MSR_ITER; } +template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_HALF_ITER; } +template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_HALF_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_XAO_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_ITER; } template<> inline constexpr uint32_t cn_select_iter() { return CRYPTONIGHT_LITE_ITER; } @@ -125,14 +124,12 @@ inline uint32_t cn_select_iter(Algo algorithm, Variant variant) { switch (variant) { case VARIANT_MSR: - return CRYPTONIGHT_MSR_ITER; + case VARIANT_HALF: + return CRYPTONIGHT_HALF_ITER; case VARIANT_RTO: return CRYPTONIGHT_XAO_ITER; - case VARIANT_XTL2: - return CRYPTONIGHT_XTL2_ITER; - default: break; } @@ -166,7 +163,7 @@ template<> inline constexpr Variant cn_base_variant() { return VA template<> inline constexpr Variant cn_base_variant() { return VARIANT_0; } template<> inline constexpr Variant cn_base_variant() { return VARIANT_1; } template<> inline constexpr Variant cn_base_variant() { return VARIANT_2; } -template<> inline constexpr Variant cn_base_variant() { return VARIANT_2; } +template<> inline constexpr Variant cn_base_variant() { return VARIANT_2; } } /* namespace xmrig */ diff --git a/src/crypto/CryptoNight_test.h b/src/crypto/CryptoNight_test.h index dcbd85d2..63550ed8 100644 --- a/src/crypto/CryptoNight_test.h +++ b/src/crypto/CryptoNight_test.h @@ -115,8 +115,8 @@ const static uint8_t test_output_xtl[160] = { }; -// "cn/xtl2" -const static uint8_t test_output_xtl2[160] = { +// "cn/half" +const static uint8_t test_output_half[160] = { 0x5D, 0x4F, 0xBC, 0x35, 0x60, 0x97, 0xEA, 0x64, 0x40, 0xB0, 0x88, 0x8E, 0xDE, 0xB6, 0x35, 0xDD, 0xC8, 0x4A, 0x0E, 0x39, 0x7C, 0x86, 0x84, 0x56, 0x89, 0x5C, 0x3F, 0x29, 0xBE, 0x73, 0x12, 0xA7, 0x02, 0xE6, 0x1D, 0x2B, 0xBC, 0x84, 0xB6, 0x71, 0x96, 0x71, 0xD5, 0x0C, 0xAC, 0x76, 0x0E, 0x6B, diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index 87978f38..e03e6b5a 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -152,16 +152,16 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a cryptonight_quad_hash, cryptonight_penta_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_single_hash, - cryptonight_double_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, - cryptonight_triple_hash, - cryptonight_quad_hash, - cryptonight_penta_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_single_hash, + cryptonight_double_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, + cryptonight_triple_hash, + cryptonight_quad_hash, + cryptonight_penta_hash, # ifndef XMRIG_NO_AEON cryptonight_single_hash, diff --git a/src/workers/MultiWorker.cpp b/src/workers/MultiWorker.cpp index 39259d53..f0188322 100644 --- a/src/workers/MultiWorker.cpp +++ b/src/workers/MultiWorker.cpp @@ -61,7 +61,7 @@ bool MultiWorker::selfTest() verify(VARIANT_MSR, test_output_msr) && verify(VARIANT_XAO, test_output_xao) && verify(VARIANT_RTO, test_output_rto) && - verify(VARIANT_XTL2, test_output_xtl2); + verify(VARIANT_HALF, test_output_half); } # ifndef XMRIG_NO_AEON