Merge xmrig v6.14.0 into master
This commit is contained in:
commit
72abe1174a
14 changed files with 96 additions and 19 deletions
|
@ -68,6 +68,7 @@ set(HEADERS_BASE
|
|||
src/base/net/tools/MemPool.h
|
||||
src/base/net/tools/NetBuffer.h
|
||||
src/base/net/tools/Storage.h
|
||||
src/base/tools/Alignment.h
|
||||
src/base/tools/Arguments.h
|
||||
src/base/tools/Baton.h
|
||||
src/base/tools/bswap_64.h
|
||||
|
|
|
@ -66,6 +66,12 @@ bool xmrig::AutoClient::parseLogin(const rapidjson::Value &result, int *code)
|
|||
m_mode = ETH_MODE;
|
||||
setAlgo(algo);
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
if (algo.family() == Algorithm::GHOSTRIDER) {
|
||||
setExtraNonce2Size(Json::getUint64(result, "extra_nonce2_size"));
|
||||
}
|
||||
# endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ protected:
|
|||
|
||||
void setExtraNonce(const rapidjson::Value &nonce);
|
||||
|
||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||
inline void setExtraNonce2Size(uint64_t size) { m_extraNonce2Size = size; }
|
||||
# endif
|
||||
|
||||
private:
|
||||
static const char *errorMessage(const rapidjson::Value &error);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Alignment.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "base/tools/cryptonote/BlockTemplate.h"
|
||||
|
@ -73,7 +74,7 @@ bool xmrig::Job::setBlob(const char *blob)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (*nonce() != 0 && !m_nicehash) {
|
||||
if (readUnaligned(nonce()) != 0 && !m_nicehash) {
|
||||
m_nicehash = true;
|
||||
}
|
||||
|
||||
|
|
53
src/base/tools/Alignment.h
Normal file
53
src/base/tools/Alignment.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2022 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2022 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_ALIGNMENT_H
|
||||
#define XMRIG_ALIGNMENT_H
|
||||
|
||||
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline T readUnaligned(const T* ptr)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||
|
||||
T result;
|
||||
memcpy(&result, ptr, sizeof(T));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline void writeUnaligned(T* ptr, T data)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "Integer type required");
|
||||
|
||||
memcpy(ptr, &data, sizeof(T));
|
||||
}
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_ALIGNMENT_H */
|
Loading…
Add table
Add a link
Reference in a new issue