Merge xmrig v6.20.0 into master
This commit is contained in:
commit
402b70c5bb
26 changed files with 333 additions and 183 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
|
||||
|
@ -123,6 +123,21 @@ void xmrig::Api::stop()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Api::tick()
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (m_httpd->isBound() || !m_base->config()->http().isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (++m_ticks % 10 == 0) {
|
||||
m_ticks = 0;
|
||||
m_httpd->start();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Api::onConfigChanged(Config *config, Config *previousConfig)
|
||||
{
|
||||
if (config->apiId() != previousConfig->apiId()) {
|
||||
|
|
|
@ -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
|
||||
|
@ -21,7 +21,6 @@
|
|||
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
|
@ -44,7 +43,7 @@ class Api : public IBaseListener
|
|||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Api)
|
||||
|
||||
Api(Base *base);
|
||||
explicit Api(Base *base);
|
||||
~Api() override;
|
||||
|
||||
inline const char *id() const { return m_id; }
|
||||
|
@ -54,6 +53,7 @@ public:
|
|||
void request(const HttpData &req);
|
||||
void start();
|
||||
void stop();
|
||||
void tick();
|
||||
|
||||
protected:
|
||||
void onConfigChanged(Config *config, Config *previousConfig) override;
|
||||
|
@ -65,14 +65,15 @@ private:
|
|||
|
||||
Base *m_base;
|
||||
char m_id[32]{};
|
||||
String m_workerId;
|
||||
const uint64_t m_timestamp;
|
||||
Httpd *m_httpd = nullptr;
|
||||
Httpd *m_httpd = nullptr;
|
||||
std::vector<IApiListener *> m_listeners;
|
||||
String m_workerId;
|
||||
uint8_t m_ticks = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_API_H */
|
||||
#endif // XMRIG_API_H
|
||||
|
|
|
@ -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
|
||||
|
@ -22,11 +22,6 @@
|
|||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/net/http/HttpListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -43,9 +38,11 @@ class Httpd : public IBaseListener, public IHttpListener
|
|||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Httpd)
|
||||
|
||||
Httpd(Base *base);
|
||||
explicit Httpd(Base *base);
|
||||
~Httpd() override;
|
||||
|
||||
inline bool isBound() const { return m_server != nullptr; }
|
||||
|
||||
bool start();
|
||||
void stop();
|
||||
|
||||
|
@ -69,7 +66,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_HTTPD_H */
|
||||
#endif // XMRIG_HTTPD_H
|
||||
|
|
|
@ -53,6 +53,7 @@ static const CoinInfo coinInfo[] = {
|
|||
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
|
||||
{ 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 ") },
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
KEVA,
|
||||
RAVEN,
|
||||
WOWNERO,
|
||||
ZEPHYR,
|
||||
MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 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,9 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "backend/cpu/platform/HwlocCpuInfo.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
|
||||
|
||||
|
@ -29,20 +27,21 @@
|
|||
#ifndef XMRIG_OS_APPLE
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
|
||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(cpu_id));
|
||||
auto topology = Cpu::info()->topology();
|
||||
auto pu = hwloc_get_pu_obj_by_os_index(topology, static_cast<unsigned>(cpu_id));
|
||||
|
||||
if (pu == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) {
|
||||
if (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool result = (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0);
|
||||
const bool result = (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -197,6 +197,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
ar(m_vote);
|
||||
}
|
||||
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
uint8_t pricing_record[24];
|
||||
ar(pricing_record);
|
||||
}
|
||||
|
||||
// Miner transaction begin
|
||||
// Prefix begin
|
||||
setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
|
||||
|
@ -220,8 +225,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
ar(m_height);
|
||||
ar(m_numOutputs);
|
||||
|
||||
// must be 1 output
|
||||
if (m_numOutputs != 1) {
|
||||
const uint64_t expected_outputs = (m_coin == Coin::ZEPHYR) ? 2 : 1;
|
||||
if (m_numOutputs != expected_outputs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -237,7 +242,35 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
|
||||
ar(m_ephPublicKey, kKeySize);
|
||||
|
||||
if (m_outputType == 3) {
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
if (m_outputType != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t asset_type_len;
|
||||
ar(asset_type_len);
|
||||
ar.skip(asset_type_len);
|
||||
ar(m_viewTag);
|
||||
|
||||
uint64_t amount2;
|
||||
ar(amount2);
|
||||
|
||||
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);
|
||||
}
|
||||
else if (m_outputType == 3) {
|
||||
ar(m_viewTag);
|
||||
}
|
||||
|
||||
|
@ -248,6 +281,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
BlobReader<true> ar_extra(blob(TX_EXTRA_OFFSET), m_extraSize);
|
||||
ar.skip(m_extraSize);
|
||||
|
||||
bool pubkey_offset_first = true;
|
||||
|
||||
while (ar_extra.index() < m_extraSize) {
|
||||
uint64_t extra_tag = 0;
|
||||
uint64_t size = 0;
|
||||
|
@ -256,7 +291,10 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
|
||||
switch (extra_tag) {
|
||||
case 0x01: // TX_EXTRA_TAG_PUBKEY
|
||||
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
|
||||
if (pubkey_offset_first) {
|
||||
pubkey_offset_first = false;
|
||||
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
|
||||
}
|
||||
ar_extra.skip(kKeySize);
|
||||
break;
|
||||
|
||||
|
@ -277,6 +315,13 @@ bool xmrig::BlockTemplate::parse(bool hashes)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_coin == Coin::ZEPHYR) {
|
||||
uint64_t pricing_record_height, amount_burnt, amount_minted;
|
||||
ar(pricing_record_height);
|
||||
ar(amount_burnt);
|
||||
ar(amount_minted);
|
||||
}
|
||||
|
||||
setOffset(MINER_TX_PREFIX_END_OFFSET, ar.index());
|
||||
// Prefix end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue