diff --git a/src/page.h b/src/page.h index 301b1bd..688c076 100644 --- a/src/page.h +++ b/src/page.h @@ -732,6 +732,7 @@ public: // set output page template map txs.push_back(mstch::map { + {"timestamp_no" , _tx_info.receive_time}, {"timestamp" , xmreg::timestamp_to_str(_tx_info.receive_time)}, {"age" , age_str}, {"hash" , fmt::format("{:s}", _tx_info.id_hash)}, @@ -747,6 +748,15 @@ public: }); } + // sort txs in mempool based on their age + std::sort(txs.begin(), txs.end(), [](mstch::node& m1, mstch::node& m2) + { + uint64_t t1 = boost::get(boost::get(m1)["timestamp_no"]); + uint64_t t2 = boost::get(boost::get(m2)["timestamp_no"]); + + return t1 > t2; + }); + // read index.html string mempool_html = xmreg::read(TMPL_MEMPOOL);