This commit is contained in:
MoneroOcean 2020-02-15 15:41:35 -08:00
commit e71c1b51bf
58 changed files with 10426 additions and 2437 deletions

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,12 +23,12 @@
*/
#include <mutex>
#include "crypto/common/Nonce.h"
#include <mutex>
namespace xmrig {
@ -54,13 +54,23 @@ xmrig::Nonce::Nonce()
}
uint32_t xmrig::Nonce::next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash)
uint32_t xmrig::Nonce::next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash, bool *ok)
{
uint32_t next;
std::lock_guard<std::mutex> lock(mutex);
if (nicehash) {
if ((m_nonces[index] + reserveCount) > 0x1000000) {
if (ok) {
*ok = false;
}
pause(true);
return 0;
}
next = (nonce & 0xFF000000) | m_nonces[index];
}
else {

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,7 +52,7 @@ public:
static inline void stop(Backend backend) { m_sequence[backend] = 0; }
static inline void touch(Backend backend) { m_sequence[backend]++; }
static uint32_t next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash);
static uint32_t next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash, bool *ok = nullptr);
static void reset(uint8_t index);
static void stop();
static void touch();