sha256csm init
This commit is contained in:
parent
4c57b60e59
commit
90a826cbe4
17 changed files with 166 additions and 18 deletions
|
@ -101,6 +101,9 @@ const char* Algorithm::kGHOSTRIDER = "ghostrider";
|
|||
const char* Algorithm::kGHOSTRIDER_RTM = "ghostrider";
|
||||
#endif
|
||||
|
||||
#ifdef XMRIG_ALGO_SHA256CSM
|
||||
const char* Algorithm::kSHA256CSM = "sha256csm";
|
||||
#endif
|
||||
|
||||
#define ALGO_NAME(ALGO) { Algorithm::ALGO, Algorithm::k##ALGO }
|
||||
#define ALGO_ALIAS(ALGO, NAME) { NAME, Algorithm::ALGO }
|
||||
|
@ -163,6 +166,10 @@ static const std::map<uint32_t, const char *> kAlgorithmNames = {
|
|||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
ALGO_NAME(GHOSTRIDER_RTM),
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_SHA256CSM
|
||||
ALGO_NAME(SHA256CSM),
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -275,6 +282,10 @@ static const std::map<const char *, Algorithm::Id, aliasCompare> kAlgorithmAlias
|
|||
ALGO_ALIAS_AUTO(KAWPOW_RVN), ALGO_ALIAS(KAWPOW_RVN, "kawpow/rvn"),
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_SHA256CSM
|
||||
ALGO_ALIAS_AUTO(SHA256CSM), ALGO_ALIAS(SHA256CSM, "sha256csm/gale"),
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
ALGO_ALIAS_AUTO(GHOSTRIDER_RTM), ALGO_ALIAS(GHOSTRIDER_RTM, "ghostrider/rtm"),
|
||||
ALGO_ALIAS(GHOSTRIDER_RTM, "gr"),
|
||||
|
@ -353,7 +364,8 @@ std::vector<xmrig::Algorithm> xmrig::Algorithm::all(const std::function<bool(con
|
|||
RX_0, RX_WOW, RX_ARQ, RX_GRAFT, RX_SFX, RX_KEVA,
|
||||
AR2_CHUKWA, AR2_CHUKWA_V2, AR2_WRKZ,
|
||||
KAWPOW_RVN,
|
||||
GHOSTRIDER_RTM
|
||||
GHOSTRIDER_RTM,
|
||||
SHA256CSM
|
||||
};
|
||||
|
||||
Algorithms out;
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
|
||||
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
|
||||
KAWPOW_RVN = 0x6b0f0000, // "kawpow/rvn" KawPow (RVN)
|
||||
SHA256CSM = 0x6d0f0000, // "sha256csm" SHA256CSM (GalleonCoin)
|
||||
};
|
||||
|
||||
enum Family : uint32_t {
|
||||
|
@ -95,7 +96,8 @@ public:
|
|||
RANDOM_X = 0x72000000,
|
||||
ARGON2 = 0x61000000,
|
||||
KAWPOW = 0x6b000000,
|
||||
GHOSTRIDER = 0x6c000000
|
||||
GHOSTRIDER = 0x6c000000,
|
||||
SHA256 = 0x6d000000
|
||||
};
|
||||
|
||||
static const char *kINVALID;
|
||||
|
@ -163,6 +165,10 @@ public:
|
|||
static const char* kGHOSTRIDER_RTM;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_SHA256CSM
|
||||
static const char* kSHA256CSM;
|
||||
# endif
|
||||
|
||||
inline Algorithm() = default;
|
||||
inline Algorithm(const char *algo) : m_id(parse(algo)) {}
|
||||
inline Algorithm(Id id) : m_id(id) {}
|
||||
|
|
|
@ -76,9 +76,13 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
|
|||
params.PushBack(m_user.toJSON(), allocator);
|
||||
params.PushBack(result.jobId.toJSON(), allocator);
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
if (m_pool.algorithm().id() == Algorithm::GHOSTRIDER_RTM) {
|
||||
params.PushBack(Value("00000000000000000000000000000000", static_cast<uint32_t>(m_extraNonce2Size * 2)), allocator);
|
||||
} else if (m_pool.algorithm().id() == Algorithm::SHA256CSM) {
|
||||
params.PushBack(Value("00000000", static_cast<uint32_t>(m_extraNonce2Size * 2)), allocator);
|
||||
}
|
||||
if ((m_pool.algorithm().id() == Algorithm::GHOSTRIDER_RTM || m_pool.algorithm().id() == Algorithm::SHA256CSM)) {
|
||||
params.PushBack(Value(m_ntime.data(), allocator), allocator);
|
||||
|
||||
std::stringstream s;
|
||||
|
@ -113,8 +117,8 @@ int64_t xmrig::EthStratumClient::submit(const JobResult& result)
|
|||
|
||||
uint64_t actual_diff;
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
if (result.algorithm == Algorithm::GHOSTRIDER_RTM) {
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
if ((result.algorithm == Algorithm::GHOSTRIDER_RTM) || (result.algorithm == Algorithm::SHA256CSM)) {
|
||||
actual_diff = reinterpret_cast<const uint64_t*>(result.result())[3];
|
||||
}
|
||||
else
|
||||
|
@ -195,14 +199,14 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||
setExtraNonce(arr[0]);
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
if (strcmp(method, "mining.set_difficulty") == 0) {
|
||||
if (!params.IsArray()) {
|
||||
LOG_ERR("%s " RED("invalid mining.set_difficulty notification: params is not an array"), tag());
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pool.algorithm().id() != Algorithm::GHOSTRIDER_RTM) {
|
||||
if ((m_pool.algorithm().id() != Algorithm::GHOSTRIDER_RTM) && (m_pool.algorithm().id() != Algorithm::SHA256CSM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -236,7 +240,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.id() == Algorithm::GHOSTRIDER_RTM) || (algo.id() == Algorithm::SHA256CSM)) ? 8 : 6;
|
||||
|
||||
if (arr.Size() < min_arr_size) {
|
||||
LOG_ERR("%s " RED("invalid mining.notify notification: params array has wrong size"), tag());
|
||||
|
@ -256,8 +260,8 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
|
|||
|
||||
std::stringstream s;
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
if (algo.id() == Algorithm::GHOSTRIDER_RTM) {
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
if ((algo.id() == Algorithm::GHOSTRIDER_RTM) || (algo.id() == Algorithm::SHA256CSM)) {
|
||||
// Raptoreum uses Bitcoin's Stratum protocol
|
||||
// https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol#mining.notify
|
||||
|
||||
|
@ -534,7 +538,7 @@ void xmrig::EthStratumClient::onSubscribeResponse(const rapidjson::Value &result
|
|||
|
||||
setExtraNonce(arr[1]);
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
if ((arr.Size() > 2) && (arr[2].IsUint())) {
|
||||
m_extraNonce2Size = arr[2].GetUint();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
void setExtraNonce(const rapidjson::Value &nonce);
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
inline void setExtraNonce2Size(uint64_t size) { m_extraNonce2Size = size; }
|
||||
# endif
|
||||
|
||||
|
@ -62,7 +62,7 @@ private:
|
|||
bool m_authorized = false;
|
||||
std::pair<uint64_t, String> m_extraNonce{};
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
uint64_t m_extraNonce2Size = 0;
|
||||
uint64_t m_nextDifficulty = 0;
|
||||
String m_ntime;
|
||||
|
|
|
@ -218,9 +218,9 @@ xmrig::IClient *xmrig::Pool::createClient(int id, IClientListener *listener) con
|
|||
IClient *client = nullptr;
|
||||
|
||||
if (m_mode == MODE_POOL) {
|
||||
# if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
const uint32_t f = m_algorithm.family();
|
||||
if ((f == Algorithm::KAWPOW) || (f == Algorithm::GHOSTRIDER) || (m_coin == Coin::RAVEN)) {
|
||||
if ((f == Algorithm::KAWPOW) || (f == Algorithm::GHOSTRIDER) || (m_coin == Coin::RAVEN) || (f == Algorithm::SHA256)) {
|
||||
client = new EthStratumClient(id, Platform::userAgent(), listener);
|
||||
}
|
||||
else
|
||||
|
@ -237,7 +237,7 @@ xmrig::IClient *xmrig::Pool::createClient(int id, IClientListener *listener) con
|
|||
client = new SelfSelectClient(id, Platform::userAgent(), listener, m_submitToOrigin);
|
||||
}
|
||||
# endif
|
||||
# if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER
|
||||
# if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER || defined XMRIG_ALGO_SHA256CSM
|
||||
else if (m_mode == MODE_AUTO_ETH) {
|
||||
client = new AutoClient(id, Platform::userAgent(), listener);
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
|
|||
if (!m_algorithm.isValid() || (f != Algorithm::RANDOM_X
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
&& f != Algorithm::GHOSTRIDER
|
||||
# endif
|
||||
# ifdef XMRIG_ALGO_SHA256CSM
|
||||
&& f != Algorithm::SHA256
|
||||
# endif
|
||||
)) {
|
||||
m_algorithm = Algorithm::RX_0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue