From 74f30a8c5ff6b7b5f3fe1ceb67b396977bb55eed Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 11 Mar 2021 01:34:21 +0300 Subject: [PATCH] validate_tx_for_hardfork_specific_terms: added old code in comments --- src/currency_core/blockchain_storage.cpp | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 3eae004a..0b511f6b 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -4955,6 +4955,37 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti //------------------------------------------------------------------ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transaction& tx, const crypto::hash& tx_id, uint64_t block_height) const { +// if (block_height <= m_core_runtime_config.hard_fork_01_starts_after_height) +// { +// // before hardfork 1 +// +// for (const auto& el : tx.extra) +// { +// // etc_tx_details_unlock_time2 is not allowed in txs in blocks prior to hardfork 1 +// CHECK_AND_ASSERT_MES(el.type() != typeid(etc_tx_details_unlock_time2), false, "tx " << tx_id << " contains etc_tx_details_unlock_time2 which is not allowed on height " << block_height); +// } +// return true; +// } +// +// if (block_height <= m_core_runtime_config.hard_fork_02_starts_after_height) +// { +// // before hardfork 2 +// +// auto check_lambda = [&](const std::vector& container) -> bool +// { +// for (const auto& el : container) +// { +// const auto& type = el.type(); +// CHECK_AND_ASSERT_MES(type != typeid(tx_payer), false, "tx " << tx_id << " contains tx_payer which is not allowed on height " << block_height); +// CHECK_AND_ASSERT_MES(type != typeid(tx_receiver), false, "tx " << tx_id << " contains tx_receiver which is not allowed on height " << block_height); +// CHECK_AND_ASSERT_MES(type != typeid(extra_alias_entry), false, "tx " << tx_id << " contains extra_alias_entry which is not allowed on height " << block_height); +// } +// return true; +// }; +// +// return check_lambda(tx.extra) && check_lambda(tx.attachment); +// } + auto is_allowed_before_hardfork2 = [&](const payload_items_v& el) -> bool { @@ -5007,7 +5038,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti if (!var_is_after_hardfork_2_zone && !is_allowed_before_hardfork2(el)) return false; } - + return true; }