diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-11 15:53:55 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-11 15:54:19 +0100 |
commit | e7b00abfaab91dc8d6956f1a93c6ad3412c2607a (patch) | |
tree | 5e8f79d96a52d773d82efffcd683e9f9d7a7b9cc /src/rpc | |
parent | Merge pull request #365 (diff) | |
download | monero-e7b00abfaab91dc8d6956f1a93c6ad3412c2607a.tar.xz |
core_rpc_server: find transactions in the pool as well as the blockchain
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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<transaction> pool_txs; + bool r = m_core.get_pool_transactions(pool_txs); + if(r) + { + for (std::list<transaction>::const_iterator i = pool_txs.begin(); i != pool_txs.end(); ++i) + { + std::list<crypto::hash>::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; } |