aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/cryptonote_core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 21b0b4ceb..ff8bbef64 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -713,12 +713,13 @@ namespace cryptonote
//-----------------------------------------------------------------------------------------------
std::pair<uint64_t, uint64_t> core::get_coinbase_tx_sum(const uint64_t start_offset, const size_t count)
{
- std::list<block> blocks;
uint64_t emission_amount = 0;
uint64_t total_fee_amount = 0;
- this->get_blocks(start_offset, count, blocks);
- for(auto& b: blocks)
+ if (count)
{
+ const uint64_t end = start_offset + count - 1;
+ m_blockchain_storage.for_blocks_range(start_offset, end,
+ [this, &emission_amount, &total_fee_amount](uint64_t, const crypto::hash& hash, const block& b){
std::list<transaction> txs;
std::list<crypto::hash> missed_txs;
uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
@@ -731,6 +732,8 @@ namespace cryptonote
emission_amount += coinbase_amount - tx_fee_amount;
total_fee_amount += tx_fee_amount;
+ return true;
+ });
}
return std::pair<uint64_t, uint64_t>(emission_amount, total_fee_amount);