Merge xmrig v6.21.0 into master
This commit is contained in:
commit
0925865286
18 changed files with 979 additions and 750 deletions
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2023 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
|
||||
|
@ -49,6 +49,12 @@ public:
|
|||
static inline bool isUserActive(uint64_t ms) { return idleTime() < ms; }
|
||||
static inline const String &userAgent() { return m_userAgent; }
|
||||
|
||||
# ifdef XMRIG_OS_WIN
|
||||
static bool hasKeepalive();
|
||||
# else
|
||||
static constexpr bool hasKeepalive() { return true; }
|
||||
# endif
|
||||
|
||||
static bool isOnBatteryPower();
|
||||
static uint64_t idleTime();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2023 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
|
||||
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
@ -70,6 +69,12 @@ char *xmrig::Platform::createUserAgent()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::hasKeepalive()
|
||||
{
|
||||
return winOsVersion().dwMajorVersion >= 6;
|
||||
}
|
||||
|
||||
|
||||
#ifndef XMRIG_FEATURE_HWLOC
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
|
|
|
@ -159,7 +159,7 @@ void xmrig::BaseConfig::printVersions()
|
|||
snprintf(buf, sizeof buf, "MSVC/%d", MSVC_VERSION);
|
||||
# endif
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s"), "ABOUT", APP_NAME, APP_VERSION, buf);
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s") WHITE_BOLD(" (built for %s") WHITE_BOLD(" %s,") WHITE_BOLD(" %s)"), "ABOUT", APP_NAME, APP_VERSION, buf, APP_OS, APP_ARCH, APP_BITS);
|
||||
|
||||
std::string libs;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 jtgrassie <https://github.com/jtgrassie>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2023 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
|
||||
|
@ -42,13 +42,14 @@
|
|||
#include "base/io/json/JsonRequest.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IClientListener.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "base/net/dns/Dns.h"
|
||||
#include "base/net/dns/DnsRecords.h"
|
||||
#include "base/net/stratum/Socks5.h"
|
||||
#include "base/net/tools/NetBuffer.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "base/tools/cryptonote/BlobReader.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "net/JobResult.h"
|
||||
|
||||
|
||||
|
@ -345,6 +346,9 @@ bool xmrig::Client::close()
|
|||
setState(ClosingState);
|
||||
|
||||
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_socket)) == 0) {
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(m_socket, 0, 60);
|
||||
}
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose);
|
||||
}
|
||||
|
||||
|
@ -569,9 +573,9 @@ void xmrig::Client::connect(const sockaddr *addr)
|
|||
uv_tcp_init(uv_default_loop(), m_socket);
|
||||
uv_tcp_nodelay(m_socket, 1);
|
||||
|
||||
# ifndef WIN32
|
||||
uv_tcp_keepalive(m_socket, 1, 60);
|
||||
# endif
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(m_socket, 1, 60);
|
||||
}
|
||||
|
||||
uv_tcp_connect(req, m_socket, addr, onConnect);
|
||||
}
|
||||
|
@ -587,7 +591,7 @@ void xmrig::Client::handshake()
|
|||
if (isTLS()) {
|
||||
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
||||
|
||||
m_tls->handshake();
|
||||
m_tls->handshake(m_pool.isSNI() ? m_pool.host().data() : nullptr);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* 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 2019 Howard Chu <https://github.com/hyc>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright (c) 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright (c) 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright (c) 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright (c) 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright (c) 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright (c) 2019 Howard Chu <https://github.com/hyc>
|
||||
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2023 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,7 +23,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include "base/io/json/JsonRequest.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IClientListener.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "base/net/dns/Dns.h"
|
||||
#include "base/net/dns/DnsRecords.h"
|
||||
#include "base/net/http/Fetch.h"
|
||||
|
@ -42,9 +42,9 @@
|
|||
#include "base/net/stratum/SubmitResult.h"
|
||||
#include "base/net/tools/NetBuffer.h"
|
||||
#include "base/tools/bswap_64.h"
|
||||
#include "base/tools/cryptonote/Signatures.h"
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "base/tools/Timer.h"
|
||||
#include "base/tools/cryptonote/Signatures.h"
|
||||
#include "net/JobResult.h"
|
||||
|
||||
|
||||
|
@ -358,9 +358,9 @@ void xmrig::DaemonClient::onResolved(const DnsRecords &records, int status, cons
|
|||
uv_tcp_init(uv_default_loop(), s);
|
||||
uv_tcp_nodelay(s, 1);
|
||||
|
||||
# ifndef WIN32
|
||||
uv_tcp_keepalive(s, 1, 60);
|
||||
# endif
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(s, 1, 60);
|
||||
}
|
||||
|
||||
if (m_pool.zmq_port() > 0) {
|
||||
delete m_ZMQSocket;
|
||||
|
@ -589,6 +589,9 @@ void xmrig::DaemonClient::retry()
|
|||
}
|
||||
|
||||
if ((m_ZMQConnectionState != ZMQ_NOT_CONNECTED) && (m_ZMQConnectionState != ZMQ_DISCONNECTING)) {
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
|
||||
}
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), onZMQClose);
|
||||
}
|
||||
|
||||
|
@ -916,6 +919,9 @@ bool xmrig::DaemonClient::ZMQClose(bool shutdown)
|
|||
m_ZMQConnectionState = ZMQ_DISCONNECTING;
|
||||
|
||||
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_ZMQSocket)) == 0) {
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
|
||||
}
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), shutdown ? onZMQShutdown : onZMQClose);
|
||||
if (!shutdown) {
|
||||
retry();
|
||||
|
|
|
@ -77,6 +77,7 @@ const char *Pool::kSelfSelect = "self-select";
|
|||
const char *Pool::kSOCKS5 = "socks5";
|
||||
const char *Pool::kSubmitToOrigin = "submit-to-origin";
|
||||
const char *Pool::kTls = "tls";
|
||||
const char *Pool::kSni = "sni";
|
||||
const char *Pool::kUrl = "url";
|
||||
const char *Pool::kUser = "user";
|
||||
const char *Pool::kSpendSecretKey = "spend-secret-key";
|
||||
|
@ -137,6 +138,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
|||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash) || m_url.host().contains(kNicehashHost));
|
||||
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
|
||||
m_flags.set(FLAG_SNI, Json::getBool(object, kSni));
|
||||
|
||||
setKeepAlive(Json::getValue(object, kKeepalive));
|
||||
|
||||
|
@ -299,6 +301,7 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
||||
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
||||
obj.AddMember(StringRef(kSni), isSNI(), allocator);
|
||||
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
||||
obj.AddMember(StringRef(kDaemon), m_mode == MODE_DAEMON, allocator);
|
||||
obj.AddMember(StringRef(kSOCKS5), m_proxy.toJSON(doc), allocator);
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
static const char *kSOCKS5;
|
||||
static const char *kSubmitToOrigin;
|
||||
static const char *kTls;
|
||||
static const char* kSni;
|
||||
static const char *kUrl;
|
||||
static const char *kUser;
|
||||
static const char* kSpendSecretKey;
|
||||
|
@ -97,6 +98,7 @@ public:
|
|||
|
||||
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
|
||||
inline bool isTLS() const { return m_flags.test(FLAG_TLS) || m_url.isTLS(); }
|
||||
inline bool isSNI() const { return m_flags.test(FLAG_SNI); }
|
||||
inline bool isValid() const { return m_url.isValid(); }
|
||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const Coin &coin() const { return m_coin; }
|
||||
|
@ -140,6 +142,7 @@ private:
|
|||
FLAG_ENABLED,
|
||||
FLAG_NICEHASH,
|
||||
FLAG_TLS,
|
||||
FLAG_SNI,
|
||||
FLAG_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ xmrig::Client::Tls::~Tls()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Client::Tls::handshake()
|
||||
bool xmrig::Client::Tls::handshake(const char* servername)
|
||||
{
|
||||
m_ssl = SSL_new(m_ctx);
|
||||
assert(m_ssl != nullptr);
|
||||
|
@ -69,6 +69,10 @@ bool xmrig::Client::Tls::handshake()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (servername) {
|
||||
SSL_set_tlsext_host_name(m_ssl, servername);
|
||||
}
|
||||
|
||||
SSL_set_connect_state(m_ssl);
|
||||
SSL_set_bio(m_ssl, m_read, m_write);
|
||||
SSL_do_handshake(m_ssl);
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
Tls(Client *client);
|
||||
~Tls();
|
||||
|
||||
bool handshake();
|
||||
bool handshake(const char* servername);
|
||||
bool send(const char *data, size_t size);
|
||||
const char *fingerprint() const;
|
||||
const char *version() const;
|
||||
|
|
|
@ -198,7 +198,7 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
}
|
||||
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
uint8_t pricing_record[24];
|
||||
uint8_t pricing_record[120];
|
||||
ar(pricing_record);
|
||||
}
|
||||
|
||||
|
@ -225,8 +225,12 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
ar(m_height);
|
||||
ar(m_numOutputs);
|
||||
|
||||
const uint64_t expected_outputs = (m_coin == Coin::ZEPHYR) ? 2 : 1;
|
||||
if (m_numOutputs != expected_outputs) {
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
if (m_numOutputs < 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (m_numOutputs != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -252,23 +256,25 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
ar.skip(asset_type_len);
|
||||
ar(m_viewTag);
|
||||
|
||||
uint64_t amount2;
|
||||
ar(amount2);
|
||||
for (uint64_t k = 1; k < m_numOutputs; ++k) {
|
||||
uint64_t amount2;
|
||||
ar(amount2);
|
||||
|
||||
uint8_t output_type2;
|
||||
ar(output_type2);
|
||||
if (output_type2 != 2) {
|
||||
return false;
|
||||
uint8_t output_type2;
|
||||
ar(output_type2);
|
||||
if (output_type2 != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Span key2;
|
||||
ar(key2, kKeySize);
|
||||
|
||||
ar(asset_type_len);
|
||||
ar.skip(asset_type_len);
|
||||
|
||||
uint8_t view_tag2;
|
||||
ar(view_tag2);
|
||||
}
|
||||
|
||||
Span key2;
|
||||
ar(key2, kKeySize);
|
||||
|
||||
ar(asset_type_len);
|
||||
ar.skip(asset_type_len);
|
||||
|
||||
uint8_t view_tag2;
|
||||
ar(view_tag2);
|
||||
}
|
||||
else if (m_outputType == 3) {
|
||||
ar(m_viewTag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue