diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-10-11 10:30:52 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-10-11 10:30:53 +0200 |
| commit | 3db0ebafe54044fea13d8d5f09948210855fbae6 (patch) | |
| tree | bb4a186e6ef10ec4aa836887d4187f4f4f510572 /src/cryptonote_core/cryptonote_core.cpp | |
| parent | 9ea25cc8660e61b3f3ec36a1e952dfa61d698eb8 (diff) | |
| parent | 7db29d6903fe24eabaaf3b3afc364b6924d5b463 (diff) | |
| download | monzero-core-3db0ebafe54044fea13d8d5f09948210855fbae6.tar.gz monzero-core-3db0ebafe54044fea13d8d5f09948210855fbae6.tar.xz monzero-core-3db0ebafe54044fea13d8d5f09948210855fbae6.zip | |
Merge pull request #1204
7db29d6 print_coinbase_tx_sum now breaks output into fee and emission components (Dion Ahmetaj)
dd6c443 changed params from start/end index to height/count (Dion Ahmetaj)
e95d3f3 attempted to remove whitespace spam (Dion Ahmetaj)
412da63 added print_coinbase_tx_sum option (Dion Ahmetaj)
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 149fb09df..9a44d9d3f 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -616,6 +616,34 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- + std::pair<uint64_t, uint64_t> core::get_coinbase_tx_sum(const uint64_t start_offset, const uint64_t count) + { + std::list<block> blocks; + std::list<transaction> txs; + std::list<crypto::hash> missed_txs; + uint64_t coinbase_amount = 0; + uint64_t emission_amount = 0; + uint64_t total_fee_amount = 0; + uint64_t tx_fee_amount = 0; + this->get_blocks(start_offset, count, blocks); + BOOST_FOREACH(auto& b, blocks) + { + coinbase_amount = get_outs_money_amount(b.miner_tx); + this->get_transactions(b.tx_hashes, txs, missed_txs); + BOOST_FOREACH(const auto& tx, txs) + { + tx_fee_amount += get_tx_fee(tx); + } + + emission_amount += coinbase_amount - tx_fee_amount; + total_fee_amount += tx_fee_amount; + coinbase_amount = 0; + tx_fee_amount = 0; + } + + return std::pair<uint64_t, uint64_t>(emission_amount, total_fee_amount); + } + //----------------------------------------------------------------------------------------------- bool core::check_tx_inputs_keyimages_diff(const transaction& tx) const { std::unordered_set<crypto::key_image> ki; |
