Skip to content

Commit

Permalink
Fix wrong order in "GET /1/threads" endpoint, regression after sync c…
Browse files Browse the repository at this point in the history
…ode with CPU miner.
  • Loading branch information
xmrig committed Feb 21, 2019
1 parent 8944583 commit 0d1a86d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/api/ApiRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,16 @@ void ApiRouter::getThreads(rapidjson::Document &doc) const
const std::vector<xmrig::IThread *> &threads = m_controller->config()->threads();
rapidjson::Value list(rapidjson::kArrayType);

size_t i = 0;
for (const xmrig::IThread *thread : threads) {
rapidjson::Value value = thread->toAPI(doc);

rapidjson::Value hashrate(rapidjson::kArrayType);
hashrate.PushBack(normalize(hr->calc(thread->index(), Hashrate::ShortInterval)), allocator);
hashrate.PushBack(normalize(hr->calc(thread->index(), Hashrate::MediumInterval)), allocator);
hashrate.PushBack(normalize(hr->calc(thread->index(), Hashrate::LargeInterval)), allocator);
hashrate.PushBack(normalize(hr->calc(i, Hashrate::ShortInterval)), allocator);
hashrate.PushBack(normalize(hr->calc(i, Hashrate::MediumInterval)), allocator);
hashrate.PushBack(normalize(hr->calc(i, Hashrate::LargeInterval)), allocator);

i++;

value.AddMember("hashrate", hashrate, allocator);
list.PushBack(value, allocator);
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/CryptoNight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ CryptoNight::cn_hash_fun CryptoNight::fn(xmrig::Algo algorithm, xmrig::AlgoVerif
bool CryptoNight::selfTest() {
using namespace xmrig;

MemInfo info = Mem::create(&m_ctx, m_algorithm, 1);
Mem::create(&m_ctx, m_algorithm, 1);

if (m_algorithm == xmrig::CRYPTONIGHT) {
if (!verify2(VARIANT_WOW, test_input_WOW)) {
Expand Down

0 comments on commit 0d1a86d

Please sign in to comment.