From 94f7615c573fbc4b9d476ba994cf290f90dc8bf4 Mon Sep 17 00:00:00 2001 From: Thomas Winget Date: Wed, 7 Oct 2015 22:25:06 -0400 Subject: [PATCH] Remove unnecessary or defunct code --- src/cryptonote_core/blockchain.cpp | 49 ------------------------------ src/cryptonote_core/blockchain.h | 21 ------------- 2 files changed, 70 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index b3d05fa3e..2b587a4d2 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -100,55 +100,6 @@ m_is_blockchain_storing(false), m_enforce_dns_checkpoints(false), m_max_prepare_ LOG_PRINT_L3("Blockchain::" << __func__); } //------------------------------------------------------------------ -//TODO: is this still needed? I don't think so - tewinget -template -void Blockchain::serialize(archive_t & ar, const unsigned int version) -{ - key_images_container dummy_key_images_container; - - LOG_PRINT_L3("Blockchain::" << __func__); - if(version < 11) - return; - CRITICAL_REGION_LOCAL(m_blockchain_lock); - ar & m_blocks; - ar & m_blocks_index; - ar & m_transactions; - ar & dummy_key_images_container; - ar & m_alternative_chains; - ar & m_outputs; - ar & m_invalid_blocks; - ar & m_current_block_cumul_sz_limit; - /*serialization bug workaround*/ - if(version > 11) - { - uint64_t total_check_count = m_db->height() + m_blocks_index.size() + m_transactions.size() + dummy_key_images_container.size() + m_alternative_chains.size() + m_outputs.size() + m_invalid_blocks.size() + m_current_block_cumul_sz_limit; - if(archive_t::is_saving::value) - { - ar & total_check_count; - } - else - { - uint64_t total_check_count_loaded = 0; - ar & total_check_count_loaded; - if(total_check_count != total_check_count_loaded) - { - LOG_ERROR("Blockchain storage data corruption detected. total_count loaded from file = " << total_check_count_loaded << ", expected = " << total_check_count); - - LOG_PRINT_L0("Blockchain storage:" << std::endl << "m_blocks: " << m_db->height() << std::endl << "m_blocks_index: " << m_blocks_index.size() << std::endl << "m_transactions: " << m_transactions.size() << std::endl << "dummy_key_images_container: " << dummy_key_images_container.size() << std::endl << "m_alternative_chains: " << m_alternative_chains.size() << std::endl << "m_outputs: " << m_outputs.size() << std::endl << "m_invalid_blocks: " << m_invalid_blocks.size() << std::endl << "m_current_block_cumul_sz_limit: " << m_current_block_cumul_sz_limit); - - throw std::runtime_error("Blockchain data corruption"); - } - } - } - - if (version > 12) - { - ar & *m_hardfork; - } - - LOG_PRINT_L3("Blockchain storage:" << std::endl << "m_blocks: " << m_db->height() << std::endl << "m_blocks_index: " << m_blocks_index.size() << std::endl << "m_transactions: " << m_transactions.size() << std::endl << "dummy_key_images_container: " << dummy_key_images_container.size() << std::endl << "m_alternative_chains: " << m_alternative_chains.size() << std::endl << "m_outputs: " << m_outputs.size() << std::endl << "m_invalid_blocks: " << m_invalid_blocks.size() << std::endl << "m_current_block_cumul_sz_limit: " << m_current_block_cumul_sz_limit); -} -//------------------------------------------------------------------ bool Blockchain::have_tx(const crypto::hash &id) const { LOG_PRINT_L3("Blockchain::" << __func__); diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index e132da5f0..333cbe5c7 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -420,9 +420,6 @@ namespace cryptonote */ bool handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NOTIFY_RESPONSE_GET_OBJECTS::request& rsp); - //FIXME: function declared, but never defined or used. Candidate for removal. - bool handle_get_objects(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res); - /** * @brief gets random outputs to mix with * @@ -887,9 +884,6 @@ namespace cryptonote */ bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins); - //FIXME: function declared but neither defined nor used, candidate for removal - bool validate_transaction(const block& b, uint64_t height, const transaction& tx); - /** * @brief reverts the blockchain to its previous state following a failed switch * @@ -904,18 +898,6 @@ namespace cryptonote */ bool rollback_blockchain_switching(std::list& original_chain, uint64_t rollback_height); - //FIXME: function declared but neither defined nor used, candidate for removal, - // remnant from old blockchain_storage implementation - bool add_transaction_from_block(const transaction& tx, const crypto::hash& tx_id, const crypto::hash& bl_id, uint64_t bl_height); - - //FIXME: function declared but neither defined nor used, candidate for removal, - // remnant from old blockchain_storage implementation - bool push_transaction_to_global_outs_index(const transaction& tx, const crypto::hash& tx_id, std::vector& global_indexes); - - //FIXME: function declared but neither defined nor used, candidate for removal, - // remnant from old blockchain_storage implementation - bool pop_transaction_from_global_index(const transaction& tx, const crypto::hash& tx_id); - /** * @brief gets recent block sizes for median calculation * @@ -1043,9 +1025,6 @@ namespace cryptonote */ bool check_for_double_spend(const transaction& tx, key_images_container& keys_this_block) const; - //FIXME: function declared but neither defined nor used, candidate for removal, - void get_timestamp_and_difficulty(uint64_t ×tamp, difficulty_type &difficulty, const int offset) const; - /** * @brief validates a transaction input's ring signature *