fee per kB added to transaction pool

https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/107
This commit is contained in:
moneroexamples 2018-03-09 08:54:31 +08:00
parent f0e562217b
commit 4f15c6164d
4 changed files with 12 additions and 8 deletions

View File

@ -169,7 +169,7 @@ MempoolStatus::read_mempool()
last_tx.num_nonrct_inputs = sum_data[3];
last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.3f}", false);
last_tx.payed_for_kB_str = fmt::format("{:0.3f}", payed_for_kB);
last_tx.payed_for_kB_str = fmt::format("{:0.4f}", payed_for_kB);
last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}");
last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}");
last_tx.timestamp_str = xmreg::timestamp_to_str_gm(_tx_info.receive_time);

View File

@ -5573,6 +5573,10 @@ namespace xmreg
// use this regex to remove all non friendly characters in payment_id_as_ascii string
static std::regex e {"[^a-zA-Z0-9 ./\\\\!]"};
double tx_size = static_cast<double>(txd.size) / 1024.0;
double payed_for_kB = XMR_AMOUNT(txd.fee) / tx_size;
// initalise page tempate map with basic info about blockchain
mstch::map context {
{"testnet" , testnet},
@ -5582,9 +5586,9 @@ namespace xmreg
{"tx_pub_key" , pod_to_hex(txd.pk)},
{"blk_height" , tx_blk_height_str},
{"tx_blk_height" , tx_blk_height},
{"tx_size" , fmt::format("{:0.4f}",
static_cast<double>(txd.size) / 1024.0)},
{"tx_size" , fmt::format("{:0.4f}", tx_size)},
{"tx_fee" , xmreg::xmr_amount_to_str(txd.fee, "{:0.12f}", false)},
{"payed_for_kB" , fmt::format("{:0.12f}", payed_for_kB)},
{"tx_version" , static_cast<uint64_t>(txd.version)},
{"blk_timestamp" , blk_timestamp},
{"blk_timestamp_uint" , blk.timestamp},

View File

@ -8,8 +8,8 @@
<tr>
<td>age [h:m:s]</td>
<td>transaction hash</td>
<td>fee</td>
<td>outputs</td>
<td>fee/per_kB</td>
<!--<td>outputs</td>-->
<td>in/out/pID</td>
<td>ring size</td>
<td>tx size [kB]</td>
@ -18,8 +18,8 @@
<tr>
<td>{{age}}</td>
<td><a href="/tx/{{hash}}">{{hash}}</a></td>
<td>{{fee}}</td>
<td>{{xmr_outputs}}</td>
<td>{{fee}}/{{payed_for_kB}}</td>
<!--<td>{{xmr_outputs}}</td>-->
<td>{{no_inputs}}/{{no_outputs}}/{{pID}}</td>
<td>{{mixin}}</td>
<td>{{txsize}}</td>

View File

@ -38,7 +38,7 @@
{{/have_raw_tx}}
<tr>
<td>Block: <a href="/block/{{blk_height}}">{{blk_height}}</a></td>
<td>Fee: {{tx_fee}}</td>
<td>Fee (per_kB): {{tx_fee}} ({{payed_for_kB}})</td>
<td>Tx size: {{tx_size}} kB</td>
</tr>
<tr>