blockchain: simplify output distribution code

This commit is contained in:
moneromooo-monero 2018-09-12 19:19:22 +00:00
parent befdcbf4be
commit b2bb9312a7
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -2054,15 +2054,10 @@ bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height,
{ {
std::vector<uint64_t> heights; std::vector<uint64_t> heights;
heights.reserve(to_height + 1 - start_height); heights.reserve(to_height + 1 - start_height);
uint64_t real_start_height = start_height > 0 ? start_height-1 : start_height; for (uint64_t h = start_height; h <= to_height; ++h)
for (uint64_t h = real_start_height; h <= to_height; ++h)
heights.push_back(h); heights.push_back(h);
distribution = m_db->get_block_cumulative_rct_outputs(heights); distribution = m_db->get_block_cumulative_rct_outputs(heights);
if (start_height > 0) base = 0;
{
base = distribution[0];
distribution.erase(distribution.begin());
}
return true; return true;
} }
else else