mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
order of txs in json_mempool reversed
This commit is contained in:
parent
f4c72a3fc1
commit
a2505b7db6
1 changed files with 10 additions and 8 deletions
18
src/page.h
18
src/page.h
|
@ -4156,28 +4156,30 @@ namespace xmreg
|
||||||
uint64_t no_mempool_txs = mempool_data.size();
|
uint64_t no_mempool_txs = mempool_data.size();
|
||||||
|
|
||||||
// calculate starting and ending block numbers to show
|
// calculate starting and ending block numbers to show
|
||||||
int64_t start_height = no_mempool_txs - limit * (page + 1);
|
int64_t start_height = limit * page;
|
||||||
|
|
||||||
// check if start height is not below range
|
|
||||||
start_height = start_height < 0 ? 0 : start_height;
|
|
||||||
|
|
||||||
int64_t end_height = start_height + limit;
|
int64_t end_height = start_height + limit;
|
||||||
|
|
||||||
end_height = end_height > no_mempool_txs ? no_mempool_txs : end_height;
|
end_height = end_height > no_mempool_txs ? no_mempool_txs : end_height;
|
||||||
|
|
||||||
|
// check if start height is not below range
|
||||||
|
start_height = start_height > end_height ? end_height - limit : start_height;
|
||||||
|
|
||||||
|
start_height = start_height < 0 ? 0 : start_height;
|
||||||
|
|
||||||
// loop index
|
// loop index
|
||||||
int64_t i = end_height;
|
int64_t i = start_height;
|
||||||
|
|
||||||
json j_txs = json::array();
|
json j_txs = json::array();
|
||||||
|
|
||||||
// for each transaction in the memory pool in current page
|
// for each transaction in the memory pool in current page
|
||||||
while (i > start_height)
|
while (i < end_height)
|
||||||
{
|
{
|
||||||
const pair<tx_info, transaction>* a_pair {nullptr};
|
const pair<tx_info, transaction>* a_pair {nullptr};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
a_pair = &(mempool_data.at(i - 1));
|
a_pair = &(mempool_data.at(i));
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range& e)
|
catch (const std::out_of_range& e)
|
||||||
{
|
{
|
||||||
|
@ -4198,7 +4200,7 @@ namespace xmreg
|
||||||
|
|
||||||
j_txs.push_back(j_tx);
|
j_txs.push_back(j_tx);
|
||||||
|
|
||||||
--i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
j_data["txs"] = j_txs;
|
j_data["txs"] = j_txs;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue