Add Flex algo (for KCN coin) algo support

This commit is contained in:
MoneroOcean 2024-05-27 11:03:46 -07:00
parent 7445870414
commit bf3831c05b
43 changed files with 5160 additions and 23 deletions

View file

@ -103,6 +103,8 @@ const char *Algorithm::kKAWPOW_RVN = "kawpow";
#ifdef XMRIG_ALGO_GHOSTRIDER
const char* Algorithm::kGHOSTRIDER = "ghostrider";
const char* Algorithm::kGHOSTRIDER_RTM = "ghostrider";
const char* Algorithm::kFLEX = "flex";
const char* Algorithm::kFLEX_KCN = "flex";
#endif
#ifdef XMRIG_ALGO_RANDOMX
@ -178,6 +180,7 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
# ifdef XMRIG_ALGO_GHOSTRIDER
ALGO_NAME(GHOSTRIDER_RTM),
ALGO_NAME(FLEX_KCN),
# endif
};
@ -303,6 +306,8 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
# ifdef XMRIG_ALGO_GHOSTRIDER
ALGO_ALIAS_AUTO(GHOSTRIDER_RTM), ALGO_ALIAS(GHOSTRIDER_RTM, "ghostrider/rtm"),
ALGO_ALIAS(GHOSTRIDER_RTM, "gr"),
ALGO_ALIAS_AUTO(FLEX_KCN), ALGO_ALIAS(FLEX_KCN, "flex/kcn"),
ALGO_ALIAS(FLEX_KCN, "flex"),
# endif
};
@ -380,7 +385,8 @@ std::vector<xmrig::Algorithm> xmrig::Algorithm::all(const std::function<bool(con
RX_XLA,
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
KAWPOW_RVN,
GHOSTRIDER_RTM
GHOSTRIDER_RTM,
FLEX_KCN
};
Algorithms out;

View file

@ -73,6 +73,7 @@ public:
CN_GR_4 = 0x63120104, // "cn/turtle" GhostRider
CN_GR_5 = 0x63120105, // "cn/turtle-lite" GhostRider
GHOSTRIDER_RTM = 0x6c150000, // "ghostrider" GhostRider
FLEX_KCN = 0x6c150001, // "flex" Flex
RX_0 = 0x72151200, // "rx/0" RandomX (reference configuration).
RX_WOW = 0x72141177, // "rx/wow" RandomWOW (Wownero).
RX_ARQ = 0x72121061, // "rx/arq" RandomARQ (Arqma).
@ -172,6 +173,8 @@ public:
# ifdef XMRIG_ALGO_GHOSTRIDER
static const char* kGHOSTRIDER;
static const char* kGHOSTRIDER_RTM;
static const char* kFLEX;
static const char* kFLEX_KCN;
# endif
inline Algorithm() = default;
@ -193,8 +196,8 @@ public:
inline Id id() const { return m_id; }
inline size_t l2() const { return l2(m_id); }
inline uint32_t family() const { return family(m_id); }
inline uint32_t minIntensity() const { return ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
inline uint32_t minIntensity() const { return ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
inline size_t l3() const { return l3(m_id); }

View file

@ -77,7 +77,7 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
params.PushBack(result.jobId.toJSON(), allocator);
# ifdef XMRIG_ALGO_GHOSTRIDER
if (m_pool.algorithm().id() == Algorithm::GHOSTRIDER_RTM) {
if (m_pool.algorithm().family() == Algorithm::GHOSTRIDER) {
params.PushBack(Value("00000000000000000000000000000000", static_cast<uint32_t>(m_extraNonce2Size * 2)), allocator);
params.PushBack(Value(m_ntime.data(), allocator), allocator);
@ -114,7 +114,7 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
uint64_t actual_diff;
# ifdef XMRIG_ALGO_GHOSTRIDER
if (result.algorithm == Algorithm::GHOSTRIDER_RTM) {
if (result.algorithm.family() == Algorithm::GHOSTRIDER) {
actual_diff = reinterpret_cast<const uint64_t*>(result.result())[3];
}
else
@ -202,7 +202,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
return;
}
if (m_pool.algorithm().id() != Algorithm::GHOSTRIDER_RTM) {
if (m_pool.algorithm().family() != Algorithm::GHOSTRIDER) {
return;
}
@ -236,7 +236,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
algo = m_pool.coin().algorithm();
}
const size_t min_arr_size = (algo.id() == Algorithm::GHOSTRIDER_RTM) ? 8 : 6;
const size_t min_arr_size = (algo.family() == Algorithm::GHOSTRIDER) ? 8 : 6;
if (arr.Size() < min_arr_size) {
LOG_ERR("%s " RED("invalid mining.notify notification: params array has wrong size"), tag());
@ -257,7 +257,7 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
std::stringstream s;
# ifdef XMRIG_ALGO_GHOSTRIDER
if (algo.id() == Algorithm::GHOSTRIDER_RTM) {
if (algo.family() == Algorithm::GHOSTRIDER) {
// Raptoreum uses Bitcoin's Stratum protocol
// https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol#mining.notify

View file

@ -49,7 +49,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
blob.back() = '\0';
# ifdef XMRIG_ALGO_GHOSTRIDER
if (m_benchmark->algorithm() == Algorithm::GHOSTRIDER_RTM) {
if (m_benchmark->algorithm().family() == Algorithm::GHOSTRIDER) {
const uint32_t q = (benchmark->rotation() / 20) & 1;
const uint32_t r = benchmark->rotation() % 20;