Merged xmrig v6.21.1
This commit is contained in:
commit
923dbdf429
16 changed files with 2856 additions and 2491 deletions
|
@ -39,6 +39,7 @@
|
|||
|
||||
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -80,7 +81,8 @@ static rapidjson::Value getResources(rapidjson::Document &doc)
|
|||
|
||||
xmrig::Api::Api(Base *base) :
|
||||
m_base(base),
|
||||
m_timestamp(Chrono::currentMSecsSinceEpoch())
|
||||
m_timestamp(Chrono::currentMSecsSinceEpoch()),
|
||||
m_httpd(nullptr)
|
||||
{
|
||||
base->addListener(this);
|
||||
|
||||
|
@ -91,7 +93,11 @@ xmrig::Api::Api(Base *base) :
|
|||
xmrig::Api::~Api()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
delete m_httpd;
|
||||
if (m_httpd) {
|
||||
m_httpd->stop();
|
||||
delete m_httpd;
|
||||
m_httpd = nullptr; // Ensure the pointer is set to nullptr after deletion
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
@ -109,8 +115,14 @@ void xmrig::Api::start()
|
|||
genWorkerId(m_base->config()->apiWorkerId());
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
m_httpd = new Httpd(m_base);
|
||||
m_httpd->start();
|
||||
if (!m_httpd) {
|
||||
m_httpd = new Httpd(m_base);
|
||||
if (!m_httpd->start()) {
|
||||
std::cerr << "HTTP server failed to start." << std::endl;
|
||||
delete m_httpd; // Properly handle failure to start
|
||||
m_httpd = nullptr;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
@ -118,7 +130,9 @@ void xmrig::Api::start()
|
|||
void xmrig::Api::stop()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
m_httpd->stop();
|
||||
if (m_httpd) {
|
||||
m_httpd->stop();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
@ -126,13 +140,15 @@ void xmrig::Api::stop()
|
|||
void xmrig::Api::tick()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_base->config()->http().isEnabled() || m_httpd->isBound()) {
|
||||
if (!m_httpd || !m_base->config()->http().isEnabled() || m_httpd->isBound()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (++m_ticks % 10 == 0) {
|
||||
m_ticks = 0;
|
||||
m_httpd->start();
|
||||
if (m_httpd) {
|
||||
m_httpd->start();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ static const CoinInfo coinInfo[] = {
|
|||
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
|
||||
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
|
||||
{ Algorithm::RX_0, "ZEPH", "Zephyr", 120, 1000000000000, BLUE_BG_BOLD( WHITE_BOLD_S " zephyr ") },
|
||||
{ Algorithm::RX_0, "Townforge","Townforge", 30, 100000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " townforge ") },
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
RAVEN,
|
||||
WOWNERO,
|
||||
ZEPHYR,
|
||||
TOWNFORGE,
|
||||
MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 Howard Chu <https://github.com/hyc>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2024 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
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
static const char *kCoin;
|
||||
static const char *kDaemon;
|
||||
static const char *kDaemonPollInterval;
|
||||
static const char* kDaemonJobTimeout;
|
||||
static const char *kDaemonJobTimeout;
|
||||
static const char *kEnabled;
|
||||
static const char *kFingerprint;
|
||||
static const char *kKeepalive;
|
||||
|
@ -72,11 +72,11 @@ public:
|
|||
static const char *kSOCKS5;
|
||||
static const char *kSubmitToOrigin;
|
||||
static const char *kTls;
|
||||
static const char* kSni;
|
||||
static const char *kSni;
|
||||
static const char *kUrl;
|
||||
static const char *kUser;
|
||||
static const char* kSpendSecretKey;
|
||||
static const char* kDaemonZMQPort;
|
||||
static const char *kSpendSecretKey;
|
||||
static const char *kDaemonZMQPort;
|
||||
static const char *kNicehashHost;
|
||||
|
||||
constexpr static int kKeepAliveTimeout = 60;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2012-2013 The Cryptonote developers
|
||||
* Copyright (c) 2014-2021 The Monero Project
|
||||
* 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
|
||||
|
@ -207,7 +207,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
|
||||
|
||||
ar(m_txVersion);
|
||||
ar(m_unlockTime);
|
||||
|
||||
if (m_coin != Coin::TOWNFORGE) {
|
||||
ar(m_unlockTime);
|
||||
}
|
||||
|
||||
ar(m_numInputs);
|
||||
|
||||
// must be 1 input
|
||||
|
@ -280,6 +284,10 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
ar(m_viewTag);
|
||||
}
|
||||
|
||||
if (m_coin == Coin::TOWNFORGE) {
|
||||
ar(m_unlockTime);
|
||||
}
|
||||
|
||||
ar(m_extraSize);
|
||||
|
||||
setOffset(TX_EXTRA_OFFSET, ar.index());
|
||||
|
@ -335,6 +343,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
uint8_t vin_rct_type = 0;
|
||||
ar(vin_rct_type);
|
||||
|
||||
// no way I'm parsing a full game update here
|
||||
if (m_coin == Coin::TOWNFORGE && m_height % 720 == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// must be RCTTypeNull (0)
|
||||
if (vin_rct_type != 0) {
|
||||
return false;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2012-2013 The Cryptonote developers
|
||||
* Copyright (c) 2014-2021 The Monero Project
|
||||
* 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
|
||||
|
@ -33,6 +33,25 @@
|
|||
|
||||
bool xmrig::WalletAddress::decode(const char *address, size_t size)
|
||||
{
|
||||
uint64_t tf_tag = 0;
|
||||
if (size >= 4 && !strncmp(address, "TF", 2)) {
|
||||
tf_tag = 0x424200;
|
||||
switch (address[2])
|
||||
{
|
||||
case '1': tf_tag |= 0; break;
|
||||
case '2': tf_tag |= 1; break;
|
||||
default: tf_tag = 0; return false;
|
||||
}
|
||||
switch (address[3]) {
|
||||
case 'M': tf_tag |= 0; break;
|
||||
case 'T': tf_tag |= 0x10; break;
|
||||
case 'S': tf_tag |= 0x20; break;
|
||||
default: tf_tag = 0; return false;
|
||||
}
|
||||
address += 4;
|
||||
size -= 4;
|
||||
}
|
||||
|
||||
static constexpr std::array<int, 9> block_sizes{ 0, 2, 3, 5, 6, 7, 9, 10, 11 };
|
||||
static constexpr char alphabet[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
constexpr size_t alphabet_size = sizeof(alphabet) - 1;
|
||||
|
@ -114,6 +133,10 @@ bool xmrig::WalletAddress::decode(const char *address, size_t size)
|
|||
if (memcmp(m_checksum, md, sizeof(m_checksum)) == 0) {
|
||||
m_data = { address, size };
|
||||
|
||||
if (tf_tag) {
|
||||
m_tag = tf_tag;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +251,16 @@ const xmrig::WalletAddress::TagInfo &xmrig::WalletAddress::tagInfo(uint64_t tag)
|
|||
{ 0x54, { Coin::GRAFT, TESTNET, PUBLIC, 28881, 28882 } },
|
||||
{ 0x55, { Coin::GRAFT, TESTNET, INTEGRATED, 28881, 28882 } },
|
||||
{ 0x70, { Coin::GRAFT, TESTNET, SUBADDRESS, 28881, 28882 } },
|
||||
|
||||
{ 0x424200, { Coin::TOWNFORGE, MAINNET, PUBLIC, 18881, 18882 } },
|
||||
{ 0x424201, { Coin::TOWNFORGE, MAINNET, SUBADDRESS, 18881, 18882 } },
|
||||
|
||||
{ 0x424210, { Coin::TOWNFORGE, TESTNET, PUBLIC, 28881, 28882 } },
|
||||
{ 0x424211, { Coin::TOWNFORGE, TESTNET, SUBADDRESS, 28881, 28882 } },
|
||||
|
||||
{ 0x424220, { Coin::TOWNFORGE, STAGENET, PUBLIC, 38881, 38882 } },
|
||||
{ 0x424221, { Coin::TOWNFORGE, STAGENET, SUBADDRESS, 38881, 38882 } },
|
||||
|
||||
};
|
||||
|
||||
const auto it = tags.find(tag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue