Propagate aux difficulty to miners

This commit is contained in:
SChernykh
2023-11-19 19:43:36 +01:00
parent 394b4f310e
commit 7e0b958207
6 changed files with 45 additions and 19 deletions
+5 -1
View File
@@ -107,7 +107,7 @@ void Miner::on_block(const BlockTemplate& block)
hash seed;
const uint32_t extra_nonce = static_cast<uint32_t>(m_rng() >> 32);
j.m_blobSize = block.get_hashing_blob(extra_nonce, j.m_blob, j.m_height, j.m_sidechainHeight, j.m_diff, j.m_sidechainDiff, seed, j.m_nonceOffset, j.m_templateId);
j.m_blobSize = block.get_hashing_blob(extra_nonce, j.m_blob, j.m_height, j.m_sidechainHeight, j.m_diff, j.m_auxDiff, j.m_sidechainDiff, seed, j.m_nonceOffset, j.m_templateId);
const uint64_t next_full_nonce = (static_cast<uint64_t>(extra_nonce) << 32) | std::numeric_limits<uint32_t>::max();
const uint32_t hash_count = std::numeric_limits<uint32_t>::max() - static_cast<uint32_t>(m_fullNonce.exchange(next_full_nonce));
@@ -240,6 +240,10 @@ void Miner::run(WorkerData* data)
m_pool->submit_block_async(j.m_templateId, j.m_nonce, j.m_extraNonce);
}
if (j.m_auxDiff.check_pow(h)) {
// TODO
}
if (j.m_sidechainDiff.check_pow(h)) {
LOGINFO(0, log::Green() << "SHARE FOUND: mainchain height " << j.m_height << ", sidechain height " << j.m_sidechainHeight << ", diff " << j.m_sidechainDiff << ", worker thread " << data->m_index << '/' << data->m_count);
++m_sharesFound;