aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorNathan Dorfman <ndorf@rtfm.net>2021-09-20 14:15:59 -0600
committerNathan Dorfman <ndorf@rtfm.net>2021-09-20 17:32:01 -0600
commit2e8936f614a8f1d7eddec264c862d5099427dd9c (patch)
treed6cec4a49c3de46f03f932cccc3d4a8b90e7c20e /src/rpc
parentMerge pull request #7899 (diff)
downloadmonero-2e8936f614a8f1d7eddec264c862d5099427dd9c.tar.xz
rpc: Fix get_transactions failing when not found
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index dbf0e12e5..baacb9124 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -972,14 +972,26 @@ namespace cryptonote
LOG_PRINT_L2("Found " << found_in_pool << "/" << vh.size() << " transactions in the pool");
}
- std::vector<std::string>::const_iterator txhi = req.txs_hashes.begin();
- std::vector<crypto::hash>::const_iterator vhi = vh.begin();
+ CHECK_AND_ASSERT_MES(txs.size() + missed_txs.size() == vh.size(), false, "mismatched number of txs");
+
+ auto txhi = req.txs_hashes.cbegin();
+ auto vhi = vh.cbegin();
+ auto missedi = missed_txs.cbegin();
+
for(auto& tx: txs)
{
res.txs.push_back(COMMAND_RPC_GET_TRANSACTIONS::entry());
COMMAND_RPC_GET_TRANSACTIONS::entry &e = res.txs.back();
+ while (missedi != missed_txs.end() && *missedi == *vhi)
+ {
+ ++vhi;
+ ++txhi;
+ ++missedi;
+ }
+
crypto::hash tx_hash = *vhi++;
+ CHECK_AND_ASSERT_MES(tx_hash == std::get<0>(tx), false, "mismatched tx hash");
e.tx_hash = *txhi++;
e.prunable_hash = epee::string_tools::pod_to_hex(std::get<2>(tx));
if (req.split || req.prune || std::get<3>(tx).empty())