aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-06-07 12:22:04 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-06-07 12:22:04 -0500
commit5bfe03804c80c5e20f78315e1c37734d0ca0be42 (patch)
treebb298312640568433ec562c8097635e825aac3ee
parentMerge pull request #3940 (diff)
parentrpc: convert distribution to cumulative after caching (diff)
downloadmonero-5bfe03804c80c5e20f78315e1c37734d0ca0be42.tar.xz
Merge pull request #3892
d344736 rpc: convert distribution to cumulative after caching (moneromooo-monero)
-rw-r--r--src/rpc/core_rpc_server.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index adfadfef1..dc7b6b30f 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -2132,12 +2132,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)
{
@@ -2149,6 +2143,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});
}
}