diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-07 21:33:20 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-18 15:15:01 +0000 |
commit | 490a5d41ca2d6acdd6aa2fe643ef2773578e6910 (patch) | |
tree | b89177014a2cb20fff7c90d32c4ae0c3f6a71369 /src | |
parent | Merge pull request #2134 (diff) | |
download | monero-490a5d41ca2d6acdd6aa2fe643ef2773578e6910.tar.xz |
rpc: do not try to use an invalid txid in relay_tx
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 803588cbd..a1d4d2d38 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1436,19 +1436,25 @@ namespace cryptonote { failed = true; } - crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); - txids.push_back(txid); + else + { + crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); + txids.push_back(txid); + } } } if (!m_core.get_blockchain_storage().flush_txes_from_pool(txids)) { - res.status = "Failed to remove one more tx"; + res.status = "Failed to remove one or more tx(es)"; return false; } if (failed) { - res.status = "Failed to parse txid"; + if (txids.empty()) + res.status = "Failed to parse txid"; + else + res.status = "Failed to parse some of the txids"; return false; } @@ -1705,13 +1711,16 @@ namespace cryptonote PERF_TIMER(on_relay_tx); bool failed = false; + res.status = ""; for (const auto &str: req.txids) { cryptonote::blobdata txid_data; if(!epee::string_tools::parse_hexstr_to_binbuff(str, txid_data)) { - res.status = std::string("Invalid transaction id: ") + str; + if (!res.status.empty()) res.status += ", "; + res.status += std::string("invalid transaction id: ") + str; failed = true; + continue; } crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); @@ -1727,8 +1736,10 @@ namespace cryptonote } else { - res.status = std::string("Transaction not found in pool: ") + str; + if (!res.status.empty()) res.status += ", "; + res.status += std::string("transaction not found in pool: ") + str; failed = true; + continue; } } |