forked from lthn/blockchain
fixed coretests regarding to new tx handling schema
This commit is contained in:
parent
37537b59f3
commit
da2b26f9fe
4 changed files with 22 additions and 9 deletions
|
|
@ -6077,8 +6077,12 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
|
|||
for (auto tx_id : b.tx_hashes)
|
||||
{
|
||||
std::shared_ptr<transaction> tx_ptr;
|
||||
CHECK_AND_ASSERT_MES(get_transaction_from_pool_or_db(tx_id, tx_ptr, split_height), false, "failed to get alt block tx " << tx_id << " with split_height == " << split_height);
|
||||
transaction& tx = *tx_ptr;
|
||||
auto it = abei.onboard_transactions.find(tx_id);
|
||||
if (it == abei.onboard_transactions.end())
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(get_transaction_from_pool_or_db(tx_id, tx_ptr, split_height), false, "failed to get alt block tx " << tx_id << " with split_height == " << split_height);
|
||||
}
|
||||
const transaction& tx = it == abei.onboard_transactions.end() ? *tx_ptr : it->second;
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.size() == tx.vin.size(), false, "invalid tx: tx.signatures.size() == " << tx.signatures.size() << ", tx.vin.size() == " << tx.vin.size());
|
||||
for (size_t n = 0; n < tx.vin.size(); ++n)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -503,7 +503,6 @@ namespace currency
|
|||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate)
|
||||
{
|
||||
bvc = AUTO_VAL_INIT_T(block_verification_context);
|
||||
block b = AUTO_VAL_INIT(b);
|
||||
if (!parse_block(block_blob, b, bvc))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ namespace currency
|
|||
|
||||
typedef tools::db::cached_key_value_accessor<crypto::hash, tx_details, true, false> transactions_container;
|
||||
typedef tools::db::cached_key_value_accessor<crypto::hash, bool, false, false> hash_container;
|
||||
typedef tools::db::cached_key_value_accessor<crypto::key_image, uint64_t, false, false> key_images_container;
|
||||
//typedef tools::db::cached_key_value_accessor<crypto::key_image, uint64_t, false, false> key_images_container;
|
||||
typedef tools::db::cached_key_value_accessor<uint64_t, uint64_t, false, true> solo_options_container;
|
||||
typedef tools::db::cached_key_value_accessor<std::string, bool, false, false> aliases_container;
|
||||
typedef tools::db::cached_key_value_accessor<account_public_address, bool, false, false> address_to_aliases_container;
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ private:
|
|||
size_t m_ev_index;
|
||||
test_core_listener* m_core_listener;
|
||||
|
||||
mutable std::unordered_map<crypto::hash, currency::transaction> m_onboard_txs;
|
||||
bool m_txs_kept_by_block;
|
||||
bool m_skip_txs_blobsize_check;
|
||||
|
||||
|
|
@ -389,11 +390,19 @@ public:
|
|||
|
||||
size_t pool_size = m_c.get_pool_transactions_count();
|
||||
currency::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||
m_c.handle_incoming_tx(tx_blob, tvc, m_txs_kept_by_block);
|
||||
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
||||
bool r = check_tx_verification_context(tvc, tx_added, m_ev_index, tx, m_validator);
|
||||
LOCAL_ASSERT(r);
|
||||
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
|
||||
if (m_txs_kept_by_block)
|
||||
{
|
||||
m_onboard_txs[get_transaction_hash(tx)] = tx;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_c.handle_incoming_tx(tx_blob, tvc, m_txs_kept_by_block);
|
||||
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
||||
bool r = check_tx_verification_context(tvc, tx_added, m_ev_index, tx, m_validator);
|
||||
LOCAL_ASSERT(r);
|
||||
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -403,6 +412,7 @@ public:
|
|||
m_core_listener->before_block_pushed_to_core(b, blob_blk, m_c);
|
||||
|
||||
currency::block_verification_context bvc = AUTO_VAL_INIT(bvc);
|
||||
bvc.m_onboard_transactions.swap(m_onboard_txs);
|
||||
m_c.handle_incoming_block(blob_blk, bvc);
|
||||
bool r = check_block_verification_context(bvc, m_ev_index, b, m_validator);
|
||||
CHECK_AND_NO_ASSERT_MES(r, false, "block verification context check failed");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue