mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
Merge pull request #4369
b2bb9312
blockchain: simplify output distribution code (moneromooo-monero)befdcbf4
db_lmdb: do not use base for cumulative distribution (moneromooo-monero)
This commit is contained in:
commit
d6893aedf6
@ -3391,8 +3391,10 @@ bool BlockchainLMDB::get_output_distribution(uint64_t amount, uint64_t from_heig
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
distribution[0] += base;
|
||||||
for (size_t n = 1; n < distribution.size(); ++n)
|
for (size_t n = 1; n < distribution.size(); ++n)
|
||||||
distribution[n] += distribution[n - 1];
|
distribution[n] += distribution[n - 1];
|
||||||
|
base = 0;
|
||||||
|
|
||||||
TXN_POSTFIX_RDONLY();
|
TXN_POSTFIX_RDONLY();
|
||||||
|
|
||||||
|
@ -1818,15 +1818,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
|
||||||
|
Loading…
Reference in New Issue
Block a user