number of index of transactions changed to 150

master
moneroexamples 9 years ago
parent ac6809b5d7
commit ec1a31cad6

@ -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<mstch::array>(context["blocks"]);
@ -113,6 +113,9 @@ namespace xmreg {
// sum xmr in the inputs and ouputs of all transactions
array<uint64_t, 2> 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<uint64_t> 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]))},

@ -7,8 +7,8 @@
<tr>
<td>height</td>
<td>timestamp_(Δ mm:ss)</td>
<td>block_hash</td>
<td>reward</td>
<td>block hash</td>
<td>reward (w/ fees)</td>
<td>no_of_txs</td>
<td>xmr_outputs</td>
<td>mixin_range</td>

@ -336,6 +336,20 @@ namespace xmreg
};
uint64_t
sum_fees_in_txs(const vector<transaction>& txs)
{
uint64_t fees_sum {0};
for (const transaction& tx: txs)
{
fees_sum += get_tx_fee(tx);
}
return fees_sum;
}
vector<pair<txout_to_key, uint64_t>>
get_ouputs(const transaction& tx)

@ -138,6 +138,9 @@ namespace xmreg
array<uint64_t, 2>
sum_money_in_txs(const vector<transaction>& txs);
uint64_t
sum_fees_in_txs(const vector<transaction>& txs);
uint64_t
get_mixin_no(const transaction& tx);

Loading…
Cancel
Save