Merge pull request #2512 from SChernykh/dev
Show the number of transactions in pool job
This commit is contained in:
commit
0fdf063760
@ -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)
|
||||
{
|
||||
m_algorithm = other.m_algorithm;
|
||||
|
@ -139,6 +139,8 @@ public:
|
||||
|
||||
inline bool hasMinerSignature() const { return m_hasMinerSignature; }
|
||||
|
||||
uint32_t getNumTransactions() const;
|
||||
|
||||
private:
|
||||
void copy(const Job &other);
|
||||
void move(Job &&other);
|
||||
|
@ -274,7 +274,7 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
||||
if (!BenchState::size())
|
||||
# endif
|
||||
{
|
||||
uint64_t diff = job.diff();;
|
||||
uint64_t diff = job.diff();
|
||||
const char *scale = NetworkState::scaleDiff(diff);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), zmq_buf, diff, scale, job.algorithm().shortName(), job.height());
|
||||
char tx_buf[32] = {};
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user