mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Moved current valid algorithm to first position in algo list.
This commit is contained in:
parent
d2ca254789
commit
dc2c0552e0
1 changed files with 13 additions and 2 deletions
|
@ -27,7 +27,9 @@
|
|||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <inttypes.h>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -154,14 +156,23 @@ void xmrig::Network::onJobResult(const JobResult &result)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Network::onLogin(IStrategy *, IClient *, rapidjson::Document &doc, rapidjson::Value ¶ms)
|
||||
void xmrig::Network::onLogin(IStrategy *, IClient *client, rapidjson::Document &doc, rapidjson::Value ¶ms)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Algorithms algorithms = m_controller->miner()->algorithms();
|
||||
const Algorithm algorithm = client->pool().algorithm();
|
||||
if (algorithm.isValid()) {
|
||||
const size_t index = static_cast<size_t>(std::distance(algorithms.begin(), std::find(algorithms.begin(), algorithms.end(), algorithm)));
|
||||
if (index > 0 && index < algorithms.size()) {
|
||||
std::swap(algorithms[0], algorithms[index]);
|
||||
}
|
||||
}
|
||||
|
||||
Value algo(kArrayType);
|
||||
|
||||
for (const auto &a : m_controller->miner()->algorithms()) {
|
||||
for (const auto &a : algorithms) {
|
||||
algo.PushBack(StringRef(a.shortName()), allocator);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue