From f5465d824663ae67d5392a1a0f986027975063b7 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 29 Jun 2016 23:00:20 +0100 Subject: [PATCH] Condition v2 txes on v3 hard fork --- src/cryptonote_core/cryptonote_core.cpp | 9 +++++++++ src/cryptonote_core/tx_pool.cpp | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 5179cc8d2..880162ed2 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -498,6 +498,15 @@ namespace cryptonote } //std::cout << "!"<< tx.vin.size() << std::endl; + 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) + { + // v2 is the latest one we know + tvc.m_verifivation_failed = true; + return false; + } + if(!check_tx_syntax(tx)) { LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " syntax, rejected"); diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 7b7c22887..c2414f581 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -84,7 +84,9 @@ namespace cryptonote tvc.m_verifivation_failed = true; return false; } - if (tx.version > 2) // TODO: max 1/2 needs to be conditioned by a hard fork + + const size_t max_tx_version = version == 1 ? 1 : 2; + if (tx.version > max_tx_version) { // v2 is the latest one we know tvc.m_verifivation_failed = true;