From 64a043a18fd61c2c2020c5234887ce090a0c5ad0 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Wed, 26 Apr 2023 23:59:33 +0200 Subject: [PATCH] fixed few bugs related to aliases registration and block versions --- src/currency_core/blockchain_storage.cpp | 10 +--------- src/currency_core/currency_format_utils.cpp | 2 +- tests/core_tests/chaingen.cpp | 7 ++++--- tests/core_tests/chaingen.h | 2 ++ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 836474ac..e601b888 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -6409,15 +6409,7 @@ bool blockchain_storage::prevalidate_block(const block& bl) return true; } - // HF3 - if ( m_core_runtime_config.is_hardfork_active_for_height(3, block_height) && - !m_core_runtime_config.is_hardfork_active_for_height(4, block_height)) - { - CHECK_AND_ASSERT_MES(bl.major_version == HF3_BLOCK_MAJOR_VERSION, false, "HF3, incorrect block major version: " << (int)bl.major_version); - } - - - //after hard_fork3 + // >= HF3 if (bl.major_version > CURRENT_BLOCK_MAJOR_VERSION) { LOG_ERROR("prevalidation failed for block " << get_block_hash(bl) << ": major block version " << static_cast(bl.major_version) << " is incorrect, " << CURRENT_BLOCK_MAJOR_VERSION << " is expected" << ENDL diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index c323d7d5..c5a82881 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -3533,7 +3533,7 @@ namespace currency } if (p_amount_burnt) *p_amount_burnt = sum_of_bare_outs_burnt; - return sum_of_bare_outs_burnt == amount; + return sum_of_bare_outs_burnt >= amount; } // post HF-4 txs diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index 5ff7a81c..8822e469 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -2228,7 +2228,10 @@ bool shuffle_source_entries(std::vector& sources) //------------------------------------------------------------------------------ - +test_chain_unit_base::test_chain_unit_base() +{ + m_hardforks = get_default_core_runtime_config().hard_forks; // set default hardforks for tests (will be overriden by test if necessary) +} void test_chain_unit_base::register_callback(const std::string& cb_name, verify_callback cb) { m_callbacks[cb_name] = cb; @@ -2286,8 +2289,6 @@ test_chain_unit_enchanced::test_chain_unit_enchanced() REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_offers_count); REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_hardfork_active); REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_hardfork_inactive); - - m_hardforks = get_default_core_runtime_config().hard_forks; // set default hardforks for tests (will be overriden by test if necessary) } bool test_chain_unit_enchanced::configure_core(currency::core& c, size_t ev_index, const std::vector& events) diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 4662a530..a6222192 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -230,6 +230,8 @@ class test_generator; class test_chain_unit_base { public: + test_chain_unit_base(); + typedef boost::function &events)> verify_callback; typedef std::map callbacks_map;