Merge pull request #3893

410c6e5b rpc: convert distribution to cumulative after caching (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-05-31 21:25:58 +02:00
commit a87a19c570
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -2139,12 +2139,6 @@ namespace cryptonote
if (offset <= req.to_height && req.to_height - offset + 1 < distribution.size())
distribution.resize(req.to_height - offset + 1);
}
if (req.cumulative)
{
distribution[0] += base;
for (size_t n = 1; n < distribution.size(); ++n)
distribution[n] += distribution[n-1];
}
if (amount == 0)
{
@ -2156,6 +2150,13 @@ namespace cryptonote
d.cached = true;
}
if (req.cumulative)
{
distribution[0] += base;
for (size_t n = 1; n < distribution.size(); ++n)
distribution[n] += distribution[n-1];
}
res.distributions.push_back({amount, start_height, std::move(distribution), base});
}
}