mirror of
https://github.com/xmrig/xmrig-proxy.git
synced 2026-02-09 02:59:17 +08:00
Add support for algo extension.
This commit is contained in:
@@ -191,11 +191,9 @@ int64_t Client::submit(const JobResult &result)
|
||||
params.AddMember("nonce", StringRef(nonce), allocator);
|
||||
params.AddMember("result", StringRef(data), allocator);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT // FIXME: support it in proxy.
|
||||
if (m_extensions & AlgoExt) {
|
||||
params.AddMember("algo", StringRef(result.algorithm.shortName()), allocator);
|
||||
}
|
||||
# endif
|
||||
|
||||
doc.AddMember("params", params, allocator);
|
||||
|
||||
|
||||
@@ -29,11 +29,12 @@
|
||||
#include "net/JobResult.h"
|
||||
|
||||
|
||||
JobResult::JobResult(int64_t id, const char *jobId, const char *nonce, const char *result) :
|
||||
JobResult::JobResult(int64_t id, const char *jobId, const char *nonce, const char *result, const xmrig::Algorithm &algorithm) :
|
||||
nonce(nonce),
|
||||
result(result),
|
||||
id(id),
|
||||
diff(0),
|
||||
algorithm(algorithm),
|
||||
jobId(jobId, 3),
|
||||
m_actualDiff(0)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "common/crypto/Algorithm.h"
|
||||
#include "common/net/Id.h"
|
||||
|
||||
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
JobResult(int64_t id, const char *jobId, const char *nonce, const char *result);
|
||||
JobResult(int64_t id, const char *jobId, const char *nonce, const char *result, const xmrig::Algorithm &algorithm);
|
||||
|
||||
bool isCompatible(uint8_t fixedByte) const;
|
||||
bool isValid() const;
|
||||
@@ -53,6 +54,7 @@ public:
|
||||
const char *result;
|
||||
const int64_t id;
|
||||
uint32_t diff;
|
||||
xmrig::Algorithm algorithm;
|
||||
xmrig::Id jobId;
|
||||
|
||||
private:
|
||||
|
||||
@@ -40,7 +40,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
const xmrig::Algorithm &algorithm;
|
||||
JobResult request;
|
||||
|
||||
|
||||
@@ -53,8 +52,7 @@ public:
|
||||
protected:
|
||||
inline SubmitEvent(Miner *miner, int64_t id, const char *jobId, const char *nonce, const char *result, const xmrig::Algorithm &algorithm)
|
||||
: MinerEvent(SubmitType, miner),
|
||||
algorithm(algorithm),
|
||||
request(id, jobId, nonce, result),
|
||||
request(id, jobId, nonce, result, algorithm),
|
||||
m_error(Error::NoError)
|
||||
{}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ void NonceMapper::submit(SubmitEvent *event)
|
||||
return event->reject(Error::InvalidJobId);
|
||||
}
|
||||
|
||||
if (event->algorithm.isValid() && event->algorithm != m_storage->job().algorithm()) {
|
||||
if (event->request.algorithm.isValid() && event->request.algorithm != m_storage->job().algorithm()) {
|
||||
return event->reject(Error::IncorrectAlgorithm);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ void SimpleMapper::submit(SubmitEvent *event)
|
||||
return event->reject(Error::InvalidJobId);
|
||||
}
|
||||
|
||||
if (event->algorithm.isValid() && event->algorithm != m_job.algorithm()) {
|
||||
if (event->request.algorithm.isValid() && event->request.algorithm != m_job.algorithm()) {
|
||||
return event->reject(Error::IncorrectAlgorithm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user