diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index 272fd9e0..0b12b543 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -1621,9 +1621,14 @@ void get_confirmed_txs(const std::vector& blockchain, const map bool find_block_chain(const std::vector& events, std::vector& blockchain, map_hash2tx_t& mtx, const crypto::hash& head) { + size_t invalid_tx_index = UINT64_MAX; + size_t invalid_block_index = UINT64_MAX; std::unordered_map block_index; for(size_t i = 0, sz = events.size(); i < sz; ++i) { + if (invalid_tx_index == i || invalid_block_index == i) + continue; + const test_event_entry& ev = events[i]; if (typeid(currency::block) == ev.type()) { @@ -1643,6 +1648,14 @@ bool find_block_chain(const std::vector& events, std::vector(ev); mtx[get_transaction_hash(tx)] = &tx; } + else if (test_chain_unit_enchanced::is_event_mark_invalid_block(ev)) + { + invalid_block_index = i + 1; + } + else if (test_chain_unit_enchanced::is_event_mark_invalid_tx(ev)) + { + invalid_tx_index = i + 1; + } } bool b_success = false; diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 2e015a28..b092204e 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Zano Project +// Copyright (c) 2014-2022 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying @@ -319,6 +319,22 @@ public: bool check_hardfork_active(currency::core& c, size_t ev_index, const std::vector& events); + static bool is_event_mark_invalid_block(const test_event_entry& ev) + { + if (typeid(callback_entry) != ev.type()) + return false; + const callback_entry& ce = boost::get(ev); + return ce.callback_name == "mark_invalid_block"; + } + + static bool is_event_mark_invalid_tx(const test_event_entry& ev) + { + if (typeid(callback_entry) != ev.type()) + return false; + const callback_entry& ce = boost::get(ev); + return ce.callback_name == "mark_invalid_tx"; + } + protected: struct params_top_block