1
0
Fork 0
forked from lthn/blockchain

code cleanup

This commit is contained in:
sowle 2019-03-19 02:12:55 +03:00
parent 72f304d508
commit e38a370d74
2 changed files with 2 additions and 39 deletions

View file

@ -24,8 +24,6 @@
DISABLE_VS_WARNINGS(4244 4345 4503) //'boost::foreach_detail_::or_' : decorated name length exceeded, name was truncated
//#define TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION + 1
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "tx_pool"
ENABLE_CHANNEL_BY_DEFAULT("tx_pool");
@ -472,7 +470,6 @@ namespace currency
{
auto& tx_entry = td.second;
const crypto::hash& h = td.first;
//m_db_transactions.enumerate_items([&](uint64_t i, const crypto::hash& h, const tx_details &tx_entry)
//never remove transactions which related to alt blocks,
//or we can get network split as a worst case (impossible to switch to
@ -1179,13 +1176,6 @@ namespace currency
return true;
}
//---------------------------------------------------------------------------------
void tx_memory_pool::initialize_db_solo_options_values()
{
//m_db.begin_transaction();
//m_db_storage_major_compatibility_version = TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION;
//m_db.commit_transaction();
}
//---------------------------------------------------------------------------------
bool tx_memory_pool::init(const std::string& config_folder)
{
m_config_folder = config_folder;
@ -1198,23 +1188,10 @@ namespace currency
bool res = tools::unserialize_obj_from_file(*this, filename);
if(!res)
{
LOG_PRINT_L0("Failed to load tx pool from " << filename);
LOG_ERROR("Failed to load tx pool from " << filename);
return false;
}
// TODO
bool need_reinit = false;
//if (m_db_storage_major_compatibility_version != TRANSACTION_POOL_MAJOR_COMPATIBILITY_VERSION)
// need_reinit = true;
if (need_reinit)
{
clear();
LOG_PRINT_MAGENTA("Tx Pool reinitialized.", LOG_LEVEL_0);
}
initialize_db_solo_options_values();
LOG_PRINT_GREEN("TX_POOL Initialized ok. (" << m_transactions.size() << " transactions)", LOG_LEVEL_0);
return true;
}

View file

@ -159,7 +159,6 @@ namespace currency
bool remove_alias_info(const transaction& tx);
bool is_valid_contract_finalization_tx(const transaction &tx)const;
void initialize_db_solo_options_values();
bool remove_stuck_transactions();
bool is_transaction_ready_to_go(tx_details& txd, const crypto::hash& id)const;
bool validate_alias_info(const transaction& tx, bool is_in_block)const;
@ -170,22 +169,12 @@ namespace currency
void set_taken(const crypto::hash& id);
void reset_all_taken();
//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<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;
typedef std::unordered_map<crypto::hash, tx_details> transactions_container;
typedef std::unordered_map<crypto::key_image, uint64_t> key_images_container;
typedef std::unordered_set<crypto::hash> hash_container;
typedef std::unordered_set<std::string> aliases_container;
typedef std::unordered_set<account_public_address> aliases_addresses_container;
//main accessor
epee::shared_recursive_mutex m_dummy_rw_lock;
mutable epee::critical_section m_transactions_lock;
@ -198,9 +187,6 @@ namespace currency
aliases_container m_alias_names_set;
aliases_addresses_container m_alias_addresses_set;
//tools::db::solo_db_value<uint64_t, uint64_t, solo_options_container> m_db_storage_major_compatibility_version; -- TODO
epee::math_helper::once_a_time_seconds<30> m_remove_stuck_tx_interval;
performnce_data m_performance_data;