mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 12:09:54 +00:00
Merge pull request #3892
d344736
rpc: convert distribution to cumulative after caching (moneromooo-monero)
This commit is contained in:
commit
5bfe03804c
1 changed files with 7 additions and 6 deletions
|
@ -2132,12 +2132,6 @@ namespace cryptonote
|
||||||
if (offset <= req.to_height && req.to_height - offset + 1 < distribution.size())
|
if (offset <= req.to_height && req.to_height - offset + 1 < distribution.size())
|
||||||
distribution.resize(req.to_height - offset + 1);
|
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)
|
if (amount == 0)
|
||||||
{
|
{
|
||||||
|
@ -2149,6 +2143,13 @@ namespace cryptonote
|
||||||
d.cached = true;
|
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});
|
res.distributions.push_back({amount, start_height, std::move(distribution), base});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue