More GhostRider fixes

- Fixed "difficulty is not a number" when diff is high on some pools
- Fixed GhostRider compilation when WITH_KAWPOW=OFF
This commit is contained in:
SChernykh 2021-11-28 12:07:11 +01:00
parent c6292ce9ee
commit 15e5052dd0
3 changed files with 7 additions and 6 deletions

View file

@ -244,7 +244,7 @@ else()
endif() endif()
if (WITH_KAWPOW) if (WITH_KAWPOW OR WITH_GHOSTRIDER)
list(APPEND HEADERS_BASE list(APPEND HEADERS_BASE
src/base/net/stratum/AutoClient.h src/base/net/stratum/AutoClient.h
src/base/net/stratum/EthStratumClient.h src/base/net/stratum/EthStratumClient.h

View file

@ -213,12 +213,13 @@ void xmrig::EthStratumClient::parseNotification(const char *method, const rapidj
return; return;
} }
if (!arr[0].IsDouble()) { if (!arr[0].IsDouble() && !arr[0].IsUint64()) {
LOG_ERR("%s " RED("invalid mining.set_difficulty notification: difficulty is not a number"), tag()); LOG_ERR("%s " RED("invalid mining.set_difficulty notification: difficulty is not a number"), tag());
return; return;
} }
m_nextDifficulty = static_cast<uint64_t>(ceil(arr[0].GetDouble() * 65536.0)); const double diff = arr[0].IsDouble() ? arr[0].GetDouble() : arr[0].GetUint64();
m_nextDifficulty = static_cast<uint64_t>(ceil(diff * 65536.0));
} }
# endif # endif

View file

@ -31,7 +31,7 @@
#include "base/kernel/Platform.h" #include "base/kernel/Platform.h"
#include "base/net/stratum/Client.h" #include "base/net/stratum/Client.h"
#ifdef XMRIG_ALGO_KAWPOW #if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER
# include "base/net/stratum/AutoClient.h" # include "base/net/stratum/AutoClient.h"
# include "base/net/stratum/EthStratumClient.h" # include "base/net/stratum/EthStratumClient.h"
#endif #endif
@ -218,7 +218,7 @@ xmrig::IClient *xmrig::Pool::createClient(int id, IClientListener *listener) con
IClient *client = nullptr; IClient *client = nullptr;
if (m_mode == MODE_POOL) { if (m_mode == MODE_POOL) {
# ifdef XMRIG_ALGO_KAWPOW # if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER
const uint32_t f = m_algorithm.family(); 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)) {
client = new EthStratumClient(id, Platform::userAgent(), listener); client = new EthStratumClient(id, Platform::userAgent(), listener);
@ -237,7 +237,7 @@ xmrig::IClient *xmrig::Pool::createClient(int id, IClientListener *listener) con
client = new SelfSelectClient(id, Platform::userAgent(), listener, m_submitToOrigin); client = new SelfSelectClient(id, Platform::userAgent(), listener, m_submitToOrigin);
} }
# endif # endif
# ifdef XMRIG_ALGO_KAWPOW # if defined XMRIG_ALGO_KAWPOW || defined XMRIG_ALGO_GHOSTRIDER
else if (m_mode == MODE_AUTO_ETH) { else if (m_mode == MODE_AUTO_ETH) {
client = new AutoClient(id, Platform::userAgent(), listener); client = new AutoClient(id, Platform::userAgent(), listener);
} }