diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-27 18:13:50 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-27 18:13:50 +0200 |
commit | e00238a355f55e8292978297a2a659ab3137f9f3 (patch) | |
tree | 9f2686b749595a2cc8f328a104cfc74c2b7bbf34 /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #2320 (diff) | |
parent | blockchain: cap memory size of retrieved blocks (diff) | |
download | monero-e00238a355f55e8292978297a2a659ab3137f9f3.tar.xz |
Merge pull request #2347
5807529e blockchain: cap memory size of retrieved blocks (moneromooo-monero)
c1b10381 rpc: decrease memory usage a bit in getblocks.bin (moneromooo-monero)
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 02d2935f6..a6a61705b 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -205,14 +205,17 @@ namespace cryptonote } size_t txidx = 0; ntxes += bd.second.size(); - for(const auto& t: bd.second) + for (std::list<cryptonote::blobdata>::iterator i = bd.second.begin(); i != bd.second.end(); ++i) { + unpruned_size += i->size(); if (req.prune) - res.blocks.back().txs.push_back(get_pruned_tx_blob(t)); + res.blocks.back().txs.push_back(get_pruned_tx_blob(std::move(*i))); else - res.blocks.back().txs.push_back(t); + res.blocks.back().txs.push_back(std::move(*i)); + i->clear(); + i->shrink_to_fit(); pruned_size += res.blocks.back().txs.back().size(); - unpruned_size += t.size(); + res.output_indices.back().indices.push_back(COMMAND_RPC_GET_BLOCKS_FAST::tx_output_indices()); bool r = m_core.get_tx_outputs_gindexs(b.tx_hashes[txidx++], res.output_indices.back().indices.back().indices); if (!r) |