From cdb58b727f89cd5ddc5c437d1d231ca1d8900707 Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 31 Oct 2022 18:21:06 +0100 Subject: [PATCH] coretests: wallet_test_core_proxy::update_blockchain() skips bad txs (it helps to calculate balance correctly in gen mode) --- tests/core_tests/wallet_test_core_proxy.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/core_tests/wallet_test_core_proxy.cpp b/tests/core_tests/wallet_test_core_proxy.cpp index ee9d1363..e303bc8c 100644 --- a/tests/core_tests/wallet_test_core_proxy.cpp +++ b/tests/core_tests/wallet_test_core_proxy.cpp @@ -32,9 +32,16 @@ bool wallet_test_core_proxy::update_blockchain(const std::vectorb.tx_hashes.begin(), b->b.tx_hashes.end(), [&confirmed_txs](const crypto::hash& h) { confirmed_txs.insert(h); }); - for (auto e : events) + size_t invalid_tx_index = UINT64_MAX; + for (size_t i = 0; i < events.size(); ++i) { - if (e.type() != typeid(currency::transaction)) + const test_event_entry& e = events[i]; + if (test_chain_unit_enchanced::is_event_mark_invalid_tx(e)) + { + invalid_tx_index = i + 1; + continue; + } + if (e.type() != typeid(currency::transaction) || i == invalid_tx_index) continue; const currency::transaction& tx = boost::get(e);