Update BlockTemplate class.

This commit is contained in:
XMRig 2021-08-23 18:32:58 +07:00
parent a28f411339
commit bea2a6cf5b
No known key found for this signature in database
GPG key ID: 446A53638BE94409
11 changed files with 598 additions and 257 deletions

View file

@ -352,16 +352,16 @@ void xmrig::Job::generateHashingBlob(String &blob) const
{
uint8_t root_hash[32];
const uint8_t* p = m_minerTxPrefix.data();
BlockTemplate::CalculateRootHash(p, p + m_minerTxPrefix.size(), m_minerTxMerkleTreeBranch, root_hash);
BlockTemplate::calculateRootHash(p, p + m_minerTxPrefix.size(), m_minerTxMerkleTreeBranch, root_hash);
uint64_t root_hash_offset = nonceOffset() + nonceSize();
if (m_hasMinerSignature) {
root_hash_offset += BlockTemplate::SIGNATURE_SIZE + 2 /* vote */;
root_hash_offset += BlockTemplate::kSignatureSize + 2 /* vote */;
}
blob = rawBlob();
Cvt::toHex(blob.data() + root_hash_offset * 2, 64, root_hash, BlockTemplate::HASH_SIZE);
Cvt::toHex(blob.data() + root_hash_offset * 2, 64, root_hash, BlockTemplate::kHashSize);
}
@ -374,7 +374,7 @@ void xmrig::Job::generateMinerSignature(const uint8_t* blob, size_t size, uint8_
memcpy(tmp, blob, size);
// Fill signature with zeros
memset(tmp + nonceOffset() + nonceSize(), 0, BlockTemplate::SIGNATURE_SIZE);
memset(tmp + nonceOffset() + nonceSize(), 0, BlockTemplate::kSignatureSize);
uint8_t prefix_hash[32];
xmrig::keccak(tmp, static_cast<int>(size), prefix_hash, sizeof(prefix_hash));