aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-08-13 20:03:30 +0200
committerRiccardo Spagni <ric@spagni.net>2015-08-13 20:03:34 +0200
commit9564dcab484f37acc57f3e0238f2929f81710f55 (patch)
treee50b46df805c447c08a011f138dd0d1fb898dac0
parentMerge pull request #366 (diff)
parentcore_rpc_server: find transactions in the pool as well as the blockchain (diff)
downloadmonero-9564dcab484f37acc57f3e0238f2929f81710f55.tar.xz
Merge pull request #367
e7b00ab core_rpc_server: find transactions in the pool as well as the blockchain (moneromooo-monero)
-rw-r--r--src/rpc/core_rpc_server.cpp24
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;
}