From afa790dee1b2bd4792ed986f6fcc776af2c8d43e Mon Sep 17 00:00:00 2001 From: tore-tto Date: Mon, 8 Apr 2024 12:44:01 +0530 Subject: [PATCH] Fix double-counting in coinbase tx sum --- src/cryptonote_core/cryptonote_core.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 03769b69239..0ff4213f17b 100755 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1767,7 +1767,7 @@ namespace cryptonote emission_amount = m_coinbase_cache.emissions; total_fee_amount = m_coinbase_cache.fees; burnt_beldex = m_coinbase_cache.burnt; - start_offset = m_coinbase_cache.height; + start_offset = m_coinbase_cache.height + 1; count -= m_coinbase_cache.height; } // else don't change anything; we need a subset of blocks that ends before the cache. @@ -1798,7 +1798,7 @@ namespace cryptonote total_fee_amount = m_coinbase_cache.fees; burnt_beldex = m_coinbase_cache.burnt; count -= m_coinbase_cache.height - start_offset; - start_offset = m_coinbase_cache.height; + start_offset = m_coinbase_cache.height + 1; } } if (cache_to > 0 && count > CACHE_EXCLUSIVE) { @@ -1809,7 +1809,7 @@ namespace cryptonote } } - const uint64_t end = start_offset + count - 1; + const uint64_t end = start_offset + count - 2; m_blockchain_storage.for_blocks_range(start_offset, end, [this, &cache_to, &result, &cache_build_started](uint64_t height, const crypto::hash& hash, const block& b){ auto& [emission_amount, total_fee_amount, burnt_beldex] = *result;