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)
|
#pragma warning(disable:4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <time.h>
|
#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;
|
using namespace rapidjson;
|
||||||
auto &allocator = doc.GetAllocator();
|
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);
|
Value algo(kArrayType);
|
||||||
|
|
||||||
for (const auto &a : m_controller->miner()->algorithms()) {
|
for (const auto &a : algorithms) {
|
||||||
algo.PushBack(StringRef(a.shortName()), allocator);
|
algo.PushBack(StringRef(a.shortName()), allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue