mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-11 05:14:40 +00:00
Show the number of transactions in pool job
Useful to check if pool/proxy is working properly and can also be used to compare different pools.
This commit is contained in:
parent
d24581c963
commit
929205536c
3 changed files with 36 additions and 3 deletions
|
@ -163,6 +163,31 @@ void xmrig::Job::setSigKey(const char *sig_key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t xmrig::Job::getNumTransactions() const
|
||||||
|
{
|
||||||
|
if (m_algorithm.family() > Algorithm::RANDOM_X) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t num_transactions = 0;
|
||||||
|
|
||||||
|
// Monero (and some other coins) has the number of transactions encoded as varint in the end of hashing blob
|
||||||
|
const size_t expected_tx_offset = (m_algorithm == Algorithm::RX_WOW) ? 141 : 75;
|
||||||
|
|
||||||
|
if ((m_size > expected_tx_offset) && (m_size <= expected_tx_offset + 4)) {
|
||||||
|
for (size_t i = expected_tx_offset, k = 0; i < m_size; ++i, k += 7) {
|
||||||
|
const uint8_t b = m_blob[i];
|
||||||
|
num_transactions |= static_cast<uint32_t>(b & 0x7F) << k;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return num_transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Job::copy(const Job &other)
|
void xmrig::Job::copy(const Job &other)
|
||||||
{
|
{
|
||||||
m_algorithm = other.m_algorithm;
|
m_algorithm = other.m_algorithm;
|
||||||
|
|
|
@ -139,6 +139,8 @@ public:
|
||||||
|
|
||||||
inline bool hasMinerSignature() const { return m_hasMinerSignature; }
|
inline bool hasMinerSignature() const { return m_hasMinerSignature; }
|
||||||
|
|
||||||
|
uint32_t getNumTransactions() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void copy(const Job &other);
|
void copy(const Job &other);
|
||||||
void move(Job &&other);
|
void move(Job &&other);
|
||||||
|
|
|
@ -274,7 +274,7 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
||||||
if (!BenchState::size())
|
if (!BenchState::size())
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
uint64_t diff = job.diff();;
|
uint64_t diff = job.diff();
|
||||||
const char *scale = NetworkState::scaleDiff(diff);
|
const char *scale = NetworkState::scaleDiff(diff);
|
||||||
|
|
||||||
char zmq_buf[32] = {};
|
char zmq_buf[32] = {};
|
||||||
|
@ -282,8 +282,14 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
||||||
snprintf(zmq_buf, sizeof(zmq_buf), " (ZMQ:%d)", client->pool().zmq_port());
|
snprintf(zmq_buf, sizeof(zmq_buf), " (ZMQ:%d)", client->pool().zmq_port());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d%s") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
char tx_buf[32] = {};
|
||||||
Tags::network(), client->pool().host().data(), client->pool().port(), zmq_buf, diff, scale, job.algorithm().shortName(), job.height());
|
const uint32_t num_transactions = job.getNumTransactions();
|
||||||
|
if (num_transactions > 0) {
|
||||||
|
snprintf(tx_buf, sizeof(tx_buf), " (%u tx)", num_transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d%s") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64) "%s",
|
||||||
|
Tags::network(), client->pool().host().data(), client->pool().port(), zmq_buf, diff, scale, job.algorithm().shortName(), job.height(), tx_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!donate && m_donate) {
|
if (!donate && m_donate) {
|
||||||
|
|
Loading…
Reference in a new issue