From e7b00abfaab91dc8d6956f1a93c6ad3412c2607a Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 11 Aug 2015 15:53:55 +0100 Subject: [PATCH] core_rpc_server: find transactions in the pool as well as the blockchain --- src/rpc/core_rpc_server.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 0c8384306..d5d907276 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -225,6 +225,29 @@ namespace cryptonote res.status = "Failed"; return true; } + LOG_PRINT_L2("Found " << txs.size() << "/" << vh.size() << " transactions on the blockchain"); + + // try the pool for any missing txes + size_t found_in_pool = 0; + if (!missed_txs.empty()) + { + std::list pool_txs; + bool r = m_core.get_pool_transactions(pool_txs); + if(r) + { + for (std::list::const_iterator i = pool_txs.begin(); i != pool_txs.end(); ++i) + { + std::list::iterator mi = std::find(missed_txs.begin(), missed_txs.end(), get_transaction_hash(*i)); + if (mi != missed_txs.end()) + { + missed_txs.erase(mi); + txs.push_back(*i); + ++found_in_pool; + } + } + } + LOG_PRINT_L2("Found " << found_in_pool << "/" << vh.size() << " transactions in the pool"); + } BOOST_FOREACH(auto& tx, txs) { @@ -237,6 +260,7 @@ namespace cryptonote res.missed_tx.push_back(string_tools::pod_to_hex(miss_tx)); } + LOG_PRINT_L2(res.txs_as_hex.size() << " transactions found, " << res.missed_tx.size() << " not found"); res.status = CORE_RPC_STATUS_OK; return true; }