mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
basic display of few last block hashes
This commit is contained in:
parent
38a77c6cbf
commit
87c40f4e5a
1 changed files with 23 additions and 2 deletions
25
main.cpp
25
main.cpp
|
@ -42,12 +42,33 @@ int main() {
|
||||||
fmt::print("\n\n"
|
fmt::print("\n\n"
|
||||||
"Top block height : {:d}\n", height);
|
"Top block height : {:d}\n", height);
|
||||||
|
|
||||||
std::string view {"Blockchain height {{height}}"};
|
std::string view {
|
||||||
|
"Blockchain height {{height}}\n\n"
|
||||||
|
"{{#blocks}}{{height}}: {{hash}} \n{{/blocks}}"
|
||||||
|
};
|
||||||
|
|
||||||
mstch::map context {
|
mstch::map context {
|
||||||
{"height", fmt::format("{:d}", height)}
|
{"height", fmt::format("{:d}", height)},
|
||||||
|
{"blocks", mstch::array()}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
size_t no_of_last_blocks {10};
|
||||||
|
|
||||||
|
mstch::array& blocks = boost::get<mstch::array>(context["blocks"]);
|
||||||
|
|
||||||
|
for (size_t i = height; i > height - no_of_last_blocks; --i)
|
||||||
|
{
|
||||||
|
//cryptonote::block blk;
|
||||||
|
//core_storage.get_block_by_hash(block_id, blk);
|
||||||
|
|
||||||
|
crypto::hash blk_hash = core_storage->get_block_id_by_height(i);
|
||||||
|
blocks.push_back(mstch::map {
|
||||||
|
{"height", to_string(i)},
|
||||||
|
{"hash" , fmt::format("{:s}", blk_hash)}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
crow::SimpleApp app;
|
crow::SimpleApp app;
|
||||||
|
|
||||||
CROW_ROUTE(app, "/")
|
CROW_ROUTE(app, "/")
|
||||||
|
|
Loading…
Reference in a new issue