diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-01-22 11:51:53 -0500 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-01-22 11:51:53 -0500 |
commit | 9c06a7fd04472b3ecd5a4d2141a2ca5afbaff279 (patch) | |
tree | 7c9483b6e86517df732516300bef997c683bef51 /src/cryptonote_core | |
parent | Merge pull request #1613 (diff) | |
parent | core: cache tx hashes of failing semantics txes (diff) | |
download | monero-9c06a7fd04472b3ecd5a4d2141a2ca5afbaff279.tar.xz |
Merge pull request #1615
f0989893 core: cache tx hashes of failing semantics txes (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 8 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index c8103d720..f33a4f253 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -487,6 +487,13 @@ namespace cryptonote } //std::cout << "!"<< tx.vin.size() << std::endl; + if (bad_semantics_txes.find(tx_hash) != bad_semantics_txes.end()) + { + LOG_PRINT_L1("Transaction already seen with bad semantics, rejected"); + tvc.m_verifivation_failed = true; + return false; + } + uint8_t version = m_blockchain_storage.get_current_hard_fork_version(); const size_t max_tx_version = version == 1 ? 1 : 2; if (tx.version == 0 || tx.version > max_tx_version) @@ -534,6 +541,7 @@ namespace cryptonote if(!check_tx_semantic(tx, keeped_by_block)) { LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected"); + bad_semantics_txes.insert(tx_hash); tvc.m_verifivation_failed = true; return false; } diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 89d018399..1b9518c96 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -824,6 +824,8 @@ namespace cryptonote size_t block_sync_size; time_t start_time; + + std::unordered_set<crypto::hash> bad_semantics_txes; }; } |