diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-08 18:26:59 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-20 10:11:25 +0000 |
commit | b9b307d11ade4ebc4a5fb6cc89d7f14992a7b6a0 (patch) | |
tree | 9ab5e1a842a396b5ddd840efa81736ce0c14fc06 /src/wallet/wallet2.cpp | |
parent | Merge pull request #4781 (diff) | |
download | monero-b9b307d11ade4ebc4a5fb6cc89d7f14992a7b6a0.tar.xz |
rpc: speedup get_output_distribution
and decrease the amount of data carried around
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 129b96733..c9781f0c8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2852,10 +2852,11 @@ bool wallet2::get_rct_distribution(uint64_t &start_height, std::vector<uint64_t> cryptonote::COMMAND_RPC_GET_OUTPUT_DISTRIBUTION::response res = AUTO_VAL_INIT(res); req.amounts.push_back(0); req.from_height = 0; - req.cumulative = true; + req.cumulative = false; req.binary = true; + req.compress = true; m_daemon_rpc_mutex.lock(); - bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_distribution", req, res, m_http_client, rpc_timeout); + bool r = net_utils::invoke_http_bin("/get_output_distribution.bin", req, res, m_http_client, rpc_timeout); m_daemon_rpc_mutex.unlock(); if (!r) { @@ -2882,6 +2883,8 @@ bool wallet2::get_rct_distribution(uint64_t &start_height, std::vector<uint64_t> MWARNING("Failed to request output distribution: results are not for amount 0"); return false; } + for (size_t i = 1; i < res.distributions[0].data.distribution.size(); ++i) + res.distributions[0].data.distribution[i] += res.distributions[0].data.distribution[i-1]; start_height = res.distributions[0].data.start_height; distribution = std::move(res.distributions[0].data.distribution); return true; |