mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Allow null algorithm for pools.
This commit is contained in:
parent
b73c204e73
commit
6990324681
5 changed files with 56 additions and 32 deletions
|
@ -421,28 +421,28 @@ bool xmrig::Client::send(BIO *bio)
|
|||
|
||||
bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm) const
|
||||
{
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_pool.algorithm().variant() == VARIANT_AUTO || m_id == -1) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
//# ifdef XMRIG_PROXY_PROJECT
|
||||
// if (m_pool.algorithm().variant() == VARIANT_AUTO || m_id == -1) {
|
||||
// return true;
|
||||
// }
|
||||
//# endif
|
||||
|
||||
if (m_pool.algorithm() == algorithm) { // FIXME
|
||||
return true;
|
||||
}
|
||||
// if (m_pool.algorithm() == algorithm) { // FIXME
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (isQuiet()) {
|
||||
return false;
|
||||
}
|
||||
// if (isQuiet()) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (algorithm.isValid()) {
|
||||
LOG_ERR("Incompatible algorithm \"%s\" detected, reconnect", algorithm.name());
|
||||
}
|
||||
else {
|
||||
LOG_ERR("Unknown/unsupported algorithm detected, reconnect");
|
||||
}
|
||||
// if (algorithm.isValid()) {
|
||||
// LOG_ERR("Incompatible algorithm \"%s\" detected, reconnect", algorithm.name());
|
||||
// }
|
||||
// else {
|
||||
// LOG_ERR("Unknown/unsupported algorithm detected, reconnect");
|
||||
// }
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,11 @@ bool xmrig::Pool::isEnabled() const
|
|||
}
|
||||
# endif
|
||||
|
||||
return m_flags.test(FLAG_ENABLED) && isValid() && algorithm().isValid();
|
||||
if (isDaemon() && !algorithm().isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_flags.test(FLAG_ENABLED) && isValid();
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,28 +263,34 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
Value obj(kObjectType);
|
||||
|
||||
obj.AddMember(StringRef(kAlgo), StringRef(m_algorithm.shortName()), allocator);
|
||||
obj.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kUrl), m_url.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kUser), m_user.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kPass), m_password.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kRigId), m_rigId.toJSON(), allocator);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
obj.AddMember(StringRef(kNicehash), isNicehash(), allocator);
|
||||
# endif
|
||||
if (!isDaemon()) {
|
||||
obj.AddMember(StringRef(kPass), m_password.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kRigId), m_rigId.toJSON(), allocator);
|
||||
|
||||
if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) {
|
||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive > 0, allocator);
|
||||
}
|
||||
else {
|
||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive, allocator);
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
obj.AddMember(StringRef(kNicehash), isNicehash(), allocator);
|
||||
# endif
|
||||
|
||||
if (m_keepAlive == 0 || m_keepAlive == kKeepAliveTimeout) {
|
||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive > 0, allocator);
|
||||
}
|
||||
else {
|
||||
obj.AddMember(StringRef(kKeepalive), m_keepAlive, allocator);
|
||||
}
|
||||
}
|
||||
|
||||
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
||||
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
||||
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kDaemon), m_flags.test(FLAG_DAEMON), allocator);
|
||||
obj.AddMember(StringRef(kDaemonPollInterval), m_pollInterval, allocator);
|
||||
|
||||
if (isDaemon()) {
|
||||
obj.AddMember(StringRef(kDaemonPollInterval), m_pollInterval, allocator);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ void xmrig::Pools::print() const
|
|||
i,
|
||||
(pool.isEnabled() ? (pool.isTLS() ? 32 : 36) : 31),
|
||||
pool.url().data(),
|
||||
pool.algorithm().shortName()
|
||||
pool.algorithm().isValid() ? pool.algorithm().shortName() : "auto"
|
||||
);
|
||||
|
||||
i++;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -111,6 +112,14 @@ static AlgoName const algorithm_names[] = {
|
|||
} /* namespace xmrig */
|
||||
|
||||
|
||||
rapidjson::Value xmrig::Algorithm::toJSON() const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
return isValid() ? Value(StringRef(shortName())) : Value(kNullType);
|
||||
}
|
||||
|
||||
|
||||
xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
||||
{
|
||||
switch (id) {
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -91,6 +94,8 @@ public:
|
|||
inline bool operator==(const Algorithm &other) const { return isEqual(other); }
|
||||
inline operator Algorithm::Id() const { return m_id; }
|
||||
|
||||
rapidjson::Value toJSON() const;
|
||||
|
||||
static Family family(Id id);
|
||||
static Id parse(const char *name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue