mirror of
https://github.com/monero-project/monero.git
synced 2026-08-01 08:30:25 -07:00
blockchain: ensure all blocks get their longhash precalculated
If the number of blocks to check was not a multiple of the number of preparation threads, the last few blocks would not be included in the threaded long hash calculation. Those would still get calculated when the block gets added to the chain, however, so this was only a tiny performance hit, rather than a security bug.
This commit is contained in:
@@ -3743,9 +3743,11 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::list<block_complete_e
|
||||
if (!blocks_exist)
|
||||
{
|
||||
m_blocks_longhash_table.clear();
|
||||
uint64_t thread_height = height;
|
||||
for (uint64_t i = 0; i < threads; i++)
|
||||
{
|
||||
thread_list.push_back(new boost::thread(attrs, boost::bind(&Blockchain::block_longhash_worker, this, height + (i * batches), std::cref(blocks[i]), std::ref(maps[i]))));
|
||||
thread_list.push_back(new boost::thread(attrs, boost::bind(&Blockchain::block_longhash_worker, this, thread_height, std::cref(blocks[i]), std::ref(maps[i]))));
|
||||
thread_height += blocks[i].size();
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < thread_list.size(); j++)
|
||||
|
||||
Reference in New Issue
Block a user