From 761fd4d6dba8a725a9a062058e22fefe46628eea Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sun, 4 Feb 2024 22:03:27 +0100 Subject: [PATCH] fixed few tests for mainnet-compiled version --- .../currency_format_utils_transactions.cpp | 2 +- tests/core_tests/chaingen.h | 3 +++ tests/core_tests/checkpoints_tests.cpp | 12 +++++++++++- tests/core_tests/wallet_tests.cpp | 3 --- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/currency_core/currency_format_utils_transactions.cpp b/src/currency_core/currency_format_utils_transactions.cpp index d29fab6a..029eca38 100644 --- a/src/currency_core/currency_format_utils_transactions.cpp +++ b/src/currency_core/currency_format_utils_transactions.cpp @@ -404,7 +404,7 @@ namespace currency #ifdef TESTNET return true; #else - return false; + return true; #endif } diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 97dd5bce..9799e38c 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -585,6 +585,9 @@ public: void set_hardforks(const currency::hard_forks_descriptor& hardforks); const currency::hard_forks_descriptor& get_hardforks() const { return m_hardforks; } + void load_hardforks_from(const test_chain_unit_base* pthis) { m_hardforks = pthis->get_hardforks(); } + template + void load_hardforks_from(const t_type* pthis) {} private: bool m_ignore_last_pow_in_wallets; diff --git a/tests/core_tests/checkpoints_tests.cpp b/tests/core_tests/checkpoints_tests.cpp index 5692734b..68565f8d 100644 --- a/tests/core_tests/checkpoints_tests.cpp +++ b/tests/core_tests/checkpoints_tests.cpp @@ -681,6 +681,7 @@ gen_no_attchments_in_coinbase::gen_no_attchments_in_coinbase() bool gen_no_attchments_in_coinbase::generate(std::vector& events) const { + this->on_test_generator_created(generator); uint64_t ts = 1450000000; test_core_time::adjust(ts); @@ -704,7 +705,16 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t crc.pos_minimum_heigh = 1; c.get_blockchain_storage().set_core_runtime_config(crc); - m_checkpoints.add_checkpoint(12, "475331fb4a325e722ddbc2d087d32687a58392e5a9314001120de0f2ce7737f2"); + // different checkpoints due to different block versions for different hardforks -> different hashes + if (crc.is_hardfork_active_for_height(ZANO_HARDFORK_03, 11) && !crc.is_hardfork_active_for_height(ZANO_HARDFORK_04_ZARCANUM, 11)) + { + m_checkpoints.add_checkpoint(12, "4e6055dda442e04b2feb70bc7245584742604e8515b8d2e1c3d46c26f758d59f"); + } + else + { + m_checkpoints.add_checkpoint(12, "475331fb4a325e722ddbc2d087d32687a58392e5a9314001120de0f2ce7737f2"); + } + c.set_checkpoints(currency::checkpoints(m_checkpoints)); return true; diff --git a/tests/core_tests/wallet_tests.cpp b/tests/core_tests/wallet_tests.cpp index ed3051c4..7d0727fc 100644 --- a/tests/core_tests/wallet_tests.cpp +++ b/tests/core_tests/wallet_tests.cpp @@ -1778,9 +1778,6 @@ bool gen_wallet_alias_and_unconfirmed_txs::c3(currency::core& c, size_t ev_index gen_wallet_alias_via_special_wallet_funcs::gen_wallet_alias_via_special_wallet_funcs() { - // start hardfork from block 0 in order to use extra_alias_entry (allowed only since HF2) - m_hardforks.set_hardfork_height(1, 0); - m_hardforks.set_hardfork_height(2, 0); REGISTER_CALLBACK_METHOD(gen_wallet_alias_via_special_wallet_funcs, c1); }