mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Added coin field support added in xmrig-proxy 2.5.
This commit is contained in:
parent
37ac1aa62c
commit
84970e9e9b
3 changed files with 20 additions and 0 deletions
|
@ -237,6 +237,10 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (params.HasMember("coin")) {
|
||||
job.setCoin(params["coin"].GetString());
|
||||
}
|
||||
|
||||
if (m_job == job) {
|
||||
if (!m_quiet) {
|
||||
LOG_WARN("[%s:%u] duplicate job received, reconnect", m_url.host(), m_url.port());
|
||||
|
|
|
@ -65,6 +65,7 @@ Job::Job(int poolId, bool nicehash, bool monero) :
|
|||
m_diff(0),
|
||||
m_target(0)
|
||||
{
|
||||
memset(m_coin, 0, sizeof(m_coin));
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,6 +149,18 @@ bool Job::setTarget(const char *target)
|
|||
}
|
||||
|
||||
|
||||
void Job::setCoin(const char *coin)
|
||||
{
|
||||
if (!coin || strlen(coin) > 4) {
|
||||
memset(m_coin, 0, sizeof(m_coin));
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy(m_coin, coin, sizeof(m_coin));
|
||||
m_monero = strcmp(m_coin, "XMR") == 0;
|
||||
}
|
||||
|
||||
|
||||
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
{
|
||||
bool error = false;
|
||||
|
|
|
@ -42,11 +42,13 @@ public:
|
|||
|
||||
bool setBlob(const char *blob);
|
||||
bool setTarget(const char *target);
|
||||
void setCoin(const char *coin);
|
||||
|
||||
inline bool isMonero() const { return m_monero; }
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
|
||||
inline bool setId(const char *id) { return m_id.setId(id); }
|
||||
inline const char *coin() const { return m_coin; }
|
||||
inline const uint32_t *nonce() const { return reinterpret_cast<const uint32_t*>(m_blob + 39); }
|
||||
inline const uint8_t *blob() const { return m_blob; }
|
||||
inline const xmrig::Id &id() const { return m_id; }
|
||||
|
@ -77,6 +79,7 @@ private:
|
|||
|
||||
bool m_monero;
|
||||
bool m_nicehash;
|
||||
char m_coin[5];
|
||||
int m_poolId;
|
||||
int m_threadId;
|
||||
size_t m_size;
|
||||
|
|
Loading…
Reference in a new issue