diff --git a/src/p2pool.cpp b/src/p2pool.cpp index a7a01d8..32dfa8d 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -393,7 +393,8 @@ void p2pool::download_block_headers(uint64_t current_height) ChainMain block; if (parse_block_header(data, size, block)) { if (height == prev_seed_height) { - m_hasher->set_old_seed_async(block.id); + // Do it synchronously to make sure stratum and p2p don't start before it's finished + m_hasher->set_old_seed(block.id); } } else { diff --git a/src/pow_hash.cpp b/src/pow_hash.cpp index 08ce0aa..56a6b17 100644 --- a/src/pow_hash.cpp +++ b/src/pow_hash.cpp @@ -147,39 +147,6 @@ void RandomX_Hasher::set_seed_async(const hash& seed) ); } -void RandomX_Hasher::set_old_seed_async(const hash& seed) -{ - struct Work - { - p2pool* pool; - RandomX_Hasher* hasher; - hash seed; - uv_work_t req; - }; - - Work* work = new Work{}; - work->pool = m_pool; - work->hasher = this; - work->seed = seed; - work->req.data = work; - - uv_queue_work(uv_default_loop_checked(), &work->req, - [](uv_work_t* req) - { - bkg_jobs_tracker.start("RandomX_Hasher::set_old_seed_async"); - Work* work = reinterpret_cast(req->data); - if (!work->pool->stopped()) { - work->hasher->set_old_seed(work->seed); - } - }, - [](uv_work_t* req, int) - { - delete reinterpret_cast(req->data); - bkg_jobs_tracker.stop("RandomX_Hasher::set_old_seed_async"); - } - ); -} - void RandomX_Hasher::set_seed(const hash& seed) { if (m_stopped.load()) { diff --git a/src/pow_hash.h b/src/pow_hash.h index 63ff63e..922683c 100644 --- a/src/pow_hash.h +++ b/src/pow_hash.h @@ -34,13 +34,12 @@ public: ~RandomX_Hasher(); void set_seed_async(const hash& seed); - void set_old_seed_async(const hash& seed); + void set_old_seed(const hash& seed); bool calculate(const void* data, size_t size, const hash& seed, hash& result); private: void set_seed(const hash& seed); - void set_old_seed(const hash& seed); struct ThreadSafeVM {