Skip to content

on every block at least 2 threads are created and destroyed via merkle async #1124

@spoonincode

Description

@spoonincode

This std::async(),

auto async_calculate_merkle_pow2 = [&start, &size](auto fut) {
size_t slice_size = size / fut.size();
for (size_t i=0; i<fut.size(); ++i)
fut[i] = std::async(std::launch::async, calculate_merkle_pow2<It>,
start + slice_size * i, start + slice_size * (i+1));
std::array<digest_type, fut.size()> res;
for (size_t i=0; i<fut.size(); ++i)
res[i] = fut[i].get();
return calculate_merkle_pow2(res.begin(), res.end());
};

leads to the full creation and destruction of at least 2 threads for every block. Would be nice to figure out how to use a thread pool here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions