aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-05-31 21:25:58 +0200
committerRiccardo Spagni <ric@spagni.net>2018-05-31 21:25:58 +0200
commita87a19c570d8150ff77e444f655716711791f8a1 (patch)
tree4c886f44e06471bffd7c6a34759fe484f46a6540 /src
parentMerge pull request #3891 (diff)
parentrpc: convert distribution to cumulative after caching (diff)
downloadmonero-a87a19c570d8150ff77e444f655716711791f8a1.tar.xz
Merge pull request #3893
410c6e5b rpc: convert distribution to cumulative after caching (moneromooo-monero)
Diffstat (limited to 'src')
-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 7d769e0dc..eba261fad 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -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});
}
}