From cfdd8bdc9c975836002b274412e8f00c70e6108e Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 19 May 2020 20:22:53 +0300 Subject: [PATCH] new core rule: new format tx_payer, tx_receiver and extra_alias_entry are not allowed before HF2 --- src/currency_core/blockchain_storage.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 89440347..59a0bfef 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -4601,6 +4601,26 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti 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); + } + + return true; } //------------------------------------------------------------------