From befdcbf4bef3a418a5fcd035b55dbadab2951d4b Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 12 Sep 2018 19:18:26 +0000 Subject: db_lmdb: do not use base for cumulative distribution it's confusing and needlessly complicated --- src/blockchain_db/lmdb/db_lmdb.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 9e22e2e4b..b0f3ca5f0 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -3391,8 +3391,10 @@ bool BlockchainLMDB::get_output_distribution(uint64_t amount, uint64_t from_heig break; } + distribution[0] += base; for (size_t n = 1; n < distribution.size(); ++n) distribution[n] += distribution[n - 1]; + base = 0; TXN_POSTFIX_RDONLY(); -- cgit v1.2.3 From b2bb9312a75781e714acf3c406634b3d4cded418 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 12 Sep 2018 19:19:22 +0000 Subject: blockchain: simplify output distribution code --- src/cryptonote_core/blockchain.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index b20fe9869..578c951be 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2054,15 +2054,10 @@ bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height, { std::vector heights; heights.reserve(to_height + 1 - start_height); - uint64_t real_start_height = start_height > 0 ? start_height-1 : start_height; - for (uint64_t h = real_start_height; h <= to_height; ++h) + for (uint64_t h = start_height; h <= to_height; ++h) heights.push_back(h); distribution = m_db->get_block_cumulative_rct_outputs(heights); - if (start_height > 0) - { - base = distribution[0]; - distribution.erase(distribution.begin()); - } + base = 0; return true; } else -- cgit v1.2.3