Consensus::get_heights_to_write is slow
in the loop:
for (auto i = std::max(current_height, first_height); i <= last_height; i++) {
messages::_KeyPub writer;
if (!get_block_writer(previous_assembly, i, &writer)) {
LOG_WARNING << "Did not manage to get the block writer for assembly "
<< previous_assembly.id() << " at height " << i;
} else if (key_pubs_map.count(writer) > 0) {
heights->push_back({i, key_pubs_map[writer]});
}
}
get_block_writer can be call more than 20000 time, and do a lot of small mongo request; maybe should we batch these request ?