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)
|
||||
{
|
||||
m_algorithm = other.m_algorithm;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue