From a9bf46a79602a4c49909feffa6399cce1eee225a Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 25 Jun 2017 06:32:00 +0800 Subject: [PATCH] add tx no to alt blocks --- src/page.h | 18 +++++++++++++----- src/templates/altblocks.html | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/page.h b/src/page.h index 2003be6..2fc0eb4 100644 --- a/src/page.h +++ b/src/page.h @@ -937,14 +937,22 @@ namespace xmreg block alt_blk; string error_msg; - blocks.push_back(mstch::map { - {"hash", alt_blk_hash} - }); + int64_t no_of_txs {-1}; + int64_t blk_height {-1}; if (rpc.get_block(alt_blk_hash, alt_blk, error_msg)) { - cout << " - alt block txs no: " << alt_blk.tx_hashes.size() << endl; + no_of_txs = alt_blk.tx_hashes.size(); + blk_height = get_block_height(alt_blk); + cout << "alt blk_height: " << blk_height << ", "; + cout << "txs no: " << alt_blk.tx_hashes.size() << endl; } + + blocks.push_back(mstch::map { + {"hash" , alt_blk_hash}, + {"no_of_txs", no_of_txs} + }); + } add_css_style(context); @@ -1149,7 +1157,7 @@ namespace xmreg else { cerr << "Cant get block: " << blk_hash << endl; - return fmt::format("Cant get block {:s} for some uknown reason", blk_hash); + return fmt::format("Cant get block {:s}", blk_hash); } return show_block(blk_height); diff --git a/src/templates/altblocks.html b/src/templates/altblocks.html index e7fba75..ddf81c1 100644 --- a/src/templates/altblocks.html +++ b/src/templates/altblocks.html @@ -7,10 +7,12 @@ + {{#blocks}} + {{/blocks}}
hashtxs no
{{hash}}{{no_of_txs}}