diff options
author | Dion Ahmetaj <Dion Ahmetaj> | 2016-10-10 15:45:51 -0400 |
---|---|---|
committer | Dion Ahmetaj <Dion Ahmetaj> | 2016-10-10 15:45:51 -0400 |
commit | 412da636225f32ba62bdba7e3ed0281dcea08b05 (patch) | |
tree | e85e4f4b94183122d8512860be490606f29741ab /src/cryptonote_core | |
parent | Merge pull request #1182 (diff) | |
download | monero-412da636225f32ba62bdba7e3ed0281dcea08b05.tar.xz |
added print_coinbase_tx_sum option
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 14 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 9 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 149fb09df..b8bceb51c 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -616,6 +616,20 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- + uint64_t core::get_coinbase_tx_sum(const uint64_t start_height, const uint64_t end_height) + { + std::list<block> blocks; + uint64_t coinbase_tx_sum = 0; + uint64_t current_index = start_height; + this->get_blocks(start_height, end_height - start_height, blocks); + BOOST_FOREACH(auto& b, blocks) + { + coinbase_tx_sum += get_outs_money_amount(b.miner_tx); + } + + return coinbase_tx_sum; + } + //----------------------------------------------------------------------------------------------- bool core::check_tx_inputs_keyimages_diff(const transaction& tx) const { std::unordered_set<crypto::key_image> ki; diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 6727d6b04..af7d30a95 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -141,7 +141,7 @@ namespace cryptonote * @note see Blockchain::cleanup_handle_incoming_blocks */ bool cleanup_handle_incoming_blocks(bool force_sync = false); - + /** * @brief check the size of a block against the current maximum * @@ -600,6 +600,13 @@ namespace cryptonote */ size_t get_block_sync_size() const { return block_sync_size; } + /** + * @brief get the sum of coinbase tx amounts between blocks + * + * @return the number of blocks to sync in one go + */ + uint64_t get_coinbase_tx_sum(const uint64_t start_height, const uint64_t end_height); + private: /** |