mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-08 19:59:30 +00:00
Miner: fixed data race
This commit is contained in:
parent
f1ff6a21ee
commit
2721b16c46
2 changed files with 4 additions and 2 deletions
|
@ -41,12 +41,14 @@ Miner::Miner(p2pool* pool, uint32_t threads)
|
||||||
, m_startTimestamp(high_resolution_clock::now())
|
, m_startTimestamp(high_resolution_clock::now())
|
||||||
, m_nonce(0)
|
, m_nonce(0)
|
||||||
, m_nonceTimestamp(m_startTimestamp)
|
, m_nonceTimestamp(m_startTimestamp)
|
||||||
, m_extraNonce(static_cast<uint32_t>(pool->p2p_server()->get_random64()))
|
|
||||||
, m_totalHashes(0)
|
, m_totalHashes(0)
|
||||||
, m_sharesFound(0)
|
, m_sharesFound(0)
|
||||||
, m_job{}
|
, m_job{}
|
||||||
, m_jobIndex{ 0 }
|
, m_jobIndex{ 0 }
|
||||||
{
|
{
|
||||||
|
std::random_device rd;
|
||||||
|
m_extraNonce = static_cast<uint32_t>(rd());
|
||||||
|
|
||||||
on_block(m_pool->block_template());
|
on_block(m_pool->block_template());
|
||||||
|
|
||||||
m_minerThreads.reserve(threads);
|
m_minerThreads.reserve(threads);
|
||||||
|
|
|
@ -56,7 +56,7 @@ private:
|
||||||
|
|
||||||
std::atomic<uint32_t> m_nonce;
|
std::atomic<uint32_t> m_nonce;
|
||||||
std::chrono::high_resolution_clock::time_point m_nonceTimestamp;
|
std::chrono::high_resolution_clock::time_point m_nonceTimestamp;
|
||||||
const uint32_t m_extraNonce;
|
uint32_t m_extraNonce;
|
||||||
|
|
||||||
std::atomic<uint64_t> m_totalHashes;
|
std::atomic<uint64_t> m_totalHashes;
|
||||||
std::atomic<uint32_t> m_sharesFound;
|
std::atomic<uint32_t> m_sharesFound;
|
||||||
|
|
Loading…
Reference in a new issue