forked from lthn/blockchain
coretests: blocks and txs that are marked as bad are now skipped by chaingen::find_block_chain
This commit is contained in:
parent
4ea5e67d44
commit
45d76ee28a
2 changed files with 30 additions and 1 deletions
|
|
@ -1621,9 +1621,14 @@ void get_confirmed_txs(const std::vector<currency::block>& blockchain, const map
|
|||
|
||||
bool find_block_chain(const std::vector<test_event_entry>& events, std::vector<currency::block>& 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<crypto::hash, const block*> 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<test_event_entry>& events, std::vector<c
|
|||
const transaction& tx = boost::get<transaction>(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;
|
||||
|
|
|
|||
|
|
@ -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<test_event_entry>& 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<callback_entry>(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<callback_entry>(ev);
|
||||
return ce.callback_name == "mark_invalid_tx";
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
struct params_top_block
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue