From ec1a31cad6622cc4335bdfe21c6ae60249a63a4f Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 12 Apr 2016 12:39:52 +0800 Subject: [PATCH] number of index of transactions changed to 150 --- src/page.h | 9 +++++++-- src/templates/index.html | 6 +++--- src/tools.cpp | 14 ++++++++++++++ src/tools.h | 3 +++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/page.h b/src/page.h index cbe152c..56b1cae 100644 --- a/src/page.h +++ b/src/page.h @@ -67,7 +67,7 @@ namespace xmreg { }; // number of last blocks to show - size_t no_of_last_blocks {100}; + size_t no_of_last_blocks {150}; // get reference to blocks template map to be field below mstch::array& blocks = boost::get(context["blocks"]); @@ -113,6 +113,9 @@ namespace xmreg { // sum xmr in the inputs and ouputs of all transactions array sum_xmr_in_out = sum_money_in_txs(txs_in_blk); + // get sum of all transactions in the block + uint64_t sum_fees = sum_fees_in_txs(txs_in_blk); + // get mixin number in each transaction vector mixin_numbers = get_mixin_no_in_txs(txs_in_blk); @@ -143,7 +146,9 @@ namespace xmreg { {"height" , to_string(i)}, {"timestamp" , timestamp_str}, {"hash" , fmt::format("{:s}", blk_hash)}, - {"block_reward", fmt::format("{:0.4f}", XMR_AMOUNT(coinbase_tx[1]))}, + {"block_reward", fmt::format("{:0.4f} ({:0.4f})", + XMR_AMOUNT(coinbase_tx[1]), + XMR_AMOUNT(sum_fees))}, {"notx" , fmt::format("{:d}", blk.tx_hashes.size())}, {"xmr_inputs" , fmt::format("{:0.4f}", XMR_AMOUNT(sum_xmr_in_out[0]))}, {"xmr_outputs" , fmt::format("{:0.4f}", XMR_AMOUNT(sum_xmr_in_out[1]))}, diff --git a/src/templates/index.html b/src/templates/index.html index 2ad60be..e6601c1 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/tools.cpp b/src/tools.cpp index 161dc70..0e895ad 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -336,6 +336,20 @@ namespace xmreg }; + uint64_t + sum_fees_in_txs(const vector& txs) + { + uint64_t fees_sum {0}; + + for (const transaction& tx: txs) + { + fees_sum += get_tx_fee(tx); + } + + return fees_sum; + } + + vector> get_ouputs(const transaction& tx) diff --git a/src/tools.h b/src/tools.h index 15b94cd..b9e9026 100644 --- a/src/tools.h +++ b/src/tools.h @@ -138,6 +138,9 @@ namespace xmreg array sum_money_in_txs(const vector& txs); + uint64_t + sum_fees_in_txs(const vector& txs); + uint64_t get_mixin_no(const transaction& tx);
heighttimestamp_(Δmm:ss)block_hashrewardtimestamp_(Δ mm:ss)block hashreward (w/ fees) no_of_txs xmr_outputs mixin_range