mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
total size of mempool in kB added
This commit is contained in:
parent
f963c152cf
commit
3b0e2d8698
3 changed files with 11 additions and 4 deletions
|
@ -15,8 +15,6 @@
|
||||||
#define OUTPUT_EXPORT_FILE_MAGIC "Monero output export\003"
|
#define OUTPUT_EXPORT_FILE_MAGIC "Monero output export\003"
|
||||||
|
|
||||||
|
|
||||||
#include "net/http_base.h"
|
|
||||||
#include "net/http_server_handlers_map2.h"
|
|
||||||
#include "net/http_client.h"
|
#include "net/http_client.h"
|
||||||
#include "storages/http_abstract_invoke.h"
|
#include "storages/http_abstract_invoke.h"
|
||||||
|
|
||||||
|
|
11
src/page.h
11
src/page.h
|
@ -656,11 +656,14 @@ public:
|
||||||
mstch::map context {
|
mstch::map context {
|
||||||
{"mempool_size", std::to_string(mempool_txs.size())},
|
{"mempool_size", std::to_string(mempool_txs.size())},
|
||||||
};
|
};
|
||||||
|
|
||||||
context.emplace("mempooltxs" , mstch::array());
|
context.emplace("mempooltxs" , mstch::array());
|
||||||
|
|
||||||
// get reference to blocks template map to be field below
|
// get reference to blocks template map to be field below
|
||||||
mstch::array& txs = boost::get<mstch::array>(context["mempooltxs"]);
|
mstch::array& txs = boost::get<mstch::array>(context["mempooltxs"]);
|
||||||
|
|
||||||
|
uint64_t mempool_size_bytes {0};
|
||||||
|
|
||||||
// for each transaction in the memory pool
|
// for each transaction in the memory pool
|
||||||
for (size_t i = 0; i < mempool_txs.size(); ++i)
|
for (size_t i = 0; i < mempool_txs.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -744,10 +747,16 @@ public:
|
||||||
{"is_ringct" , is_ringct_str},
|
{"is_ringct" , is_ringct_str},
|
||||||
{"rct_type" , rct_type_str},
|
{"rct_type" , rct_type_str},
|
||||||
{"mixin" , fmt::format("{:d}", mixin_no)},
|
{"mixin" , fmt::format("{:d}", mixin_no)},
|
||||||
{"txsize" , fmt::format("{:0.2f}", static_cast<double>(_tx_info.blob_size)/1024.0)}
|
{"txsize" , fmt::format("{:0.2f}",
|
||||||
|
static_cast<double>(_tx_info.blob_size)/1024.0)}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mempool_size_bytes += _tx_info.blob_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.insert({"mempool_size_kB",
|
||||||
|
fmt::format("{:0.2f}", static_cast<double>(mempool_size_bytes)/1024.0)});
|
||||||
|
|
||||||
// sort txs in mempool based on their age
|
// sort txs in mempool based on their age
|
||||||
std::sort(txs.begin(), txs.end(), [](mstch::node& m1, mstch::node& m2)
|
std::sort(txs.begin(), txs.end(), [](mstch::node& m1, mstch::node& m2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h2>
|
<h2>
|
||||||
Memory pool (size: {{mempool_size}})
|
Memory pool (no of txs: {{mempool_size}}, size: {{mempool_size_kB}} kB)
|
||||||
</h2>
|
</h2>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue