From 6439838103ca1604b6c5c507b100aa1334e642e8 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Fri, 2 Jun 2017 09:26:55 +0800 Subject: [PATCH] json_mempool uses mempoolstatus thread --- src/MempoolStatus.cpp | 2 +- src/MempoolStatus.h | 2 +- src/page.h | 16 +++------------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/MempoolStatus.cpp b/src/MempoolStatus.cpp index 0066e03..0de6cb0 100644 --- a/src/MempoolStatus.cpp +++ b/src/MempoolStatus.cpp @@ -112,7 +112,7 @@ MempoolStatus::read_mempool() return false; } - local_copy_of_mempool_txs.emplace_back(_tx_info.receive_time, tx); + local_copy_of_mempool_txs.emplace_back(_tx_info, tx); } // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash)) diff --git a/src/MempoolStatus.h b/src/MempoolStatus.h index 991be1f..4ec8ad4 100644 --- a/src/MempoolStatus.h +++ b/src/MempoolStatus.h @@ -22,7 +22,7 @@ namespace xmreg struct MempoolStatus { - using mempool_tx = pair; + using mempool_tx = pair; static boost::thread m_thread; diff --git a/src/page.h b/src/page.h index 781a0a4..ee351f2 100644 --- a/src/page.h +++ b/src/page.h @@ -4502,19 +4502,9 @@ namespace xmreg uint64_t height = core_storage->get_current_blockchain_height(); - vector> mempool_data; - - crypto::hash tx_hash_dummy = null_hash; - - if (!search_mempool(tx_hash_dummy, mempool_data)) - { - j_response["status"] = "error"; - j_response["message"] = fmt::format("Cant connect to the mempool"); - - return j_response; - } - - (void) tx_hash_dummy; + // get mempool tx from mempoolstatus thread + vector mempool_data + = MempoolStatus::get_mempool_txs(); uint64_t no_mempool_txs = mempool_data.size();