mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 20:06:32 +02:00
core: add consts where appropriate
This commit is contained in:
parent
8ffc508cef
commit
a7177610b3
@ -1632,7 +1632,7 @@ bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Blockchain::print_blockchain(uint64_t start_index, uint64_t end_index)
|
void Blockchain::print_blockchain(uint64_t start_index, uint64_t end_index) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -1652,7 +1652,7 @@ void Blockchain::print_blockchain(uint64_t start_index, uint64_t end_index)
|
|||||||
LOG_PRINT_L0("Blockchain printed with log level 1");
|
LOG_PRINT_L0("Blockchain printed with log level 1");
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Blockchain::print_blockchain_index()
|
void Blockchain::print_blockchain_index() const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -1670,7 +1670,7 @@ void Blockchain::print_blockchain_index()
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//TODO: remove this function and references to it
|
//TODO: remove this function and references to it
|
||||||
void Blockchain::print_blockchain_outs(const std::string& file)
|
void Blockchain::print_blockchain_outs(const std::string& file) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||||
return;
|
return;
|
||||||
|
@ -145,9 +145,9 @@ namespace cryptonote
|
|||||||
bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const;
|
bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const;
|
||||||
|
|
||||||
//debug functions
|
//debug functions
|
||||||
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
void print_blockchain(uint64_t start_index, uint64_t end_index) const;
|
||||||
void print_blockchain_index();
|
void print_blockchain_index() const;
|
||||||
void print_blockchain_outs(const std::string& file);
|
void print_blockchain_outs(const std::string& file) const;
|
||||||
|
|
||||||
void check_against_checkpoints(const checkpoints& points, bool enforce);
|
void check_against_checkpoints(const checkpoints& points, bool enforce);
|
||||||
void set_enforce_dns_checkpoints(bool enforce);
|
void set_enforce_dns_checkpoints(bool enforce);
|
||||||
|
@ -1178,7 +1178,7 @@ double blockchain_storage::get_avg_block_size( size_t count) const
|
|||||||
return average;
|
return average;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void blockchain_storage::print_blockchain(uint64_t start_index, uint64_t end_index)
|
void blockchain_storage::print_blockchain(uint64_t start_index, uint64_t end_index) const
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
@ -1198,7 +1198,7 @@ void blockchain_storage::print_blockchain(uint64_t start_index, uint64_t end_ind
|
|||||||
LOG_PRINT_L0("Blockchain printed with log level 1");
|
LOG_PRINT_L0("Blockchain printed with log level 1");
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void blockchain_storage::print_blockchain_index()
|
void blockchain_storage::print_blockchain_index() const
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
@ -1208,7 +1208,7 @@ void blockchain_storage::print_blockchain_index()
|
|||||||
LOG_PRINT_L0("Current blockchain index:" << ENDL << ss.str());
|
LOG_PRINT_L0("Current blockchain index:" << ENDL << ss.str());
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void blockchain_storage::print_blockchain_outs(const std::string& file)
|
void blockchain_storage::print_blockchain_outs(const std::string& file) const
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
|
@ -173,9 +173,9 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//debug functions
|
//debug functions
|
||||||
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
void print_blockchain(uint64_t start_index, uint64_t end_index) const;
|
||||||
void print_blockchain_index();
|
void print_blockchain_index() const;
|
||||||
void print_blockchain_outs(const std::string& file);
|
void print_blockchain_outs(const std::string& file) const;
|
||||||
void check_against_checkpoints(const checkpoints& points, bool enforce);
|
void check_against_checkpoints(const checkpoints& points, bool enforce);
|
||||||
bool update_checkpoints(const std::string& file_path, bool check_dns);
|
bool update_checkpoints(const std::string& file_path, bool check_dns);
|
||||||
void set_enforce_dns_checkpoints(bool enforce_checkpoints);
|
void set_enforce_dns_checkpoints(bool enforce_checkpoints);
|
||||||
|
@ -168,37 +168,37 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
uint64_t core::get_current_blockchain_height()
|
uint64_t core::get_current_blockchain_height() const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_current_blockchain_height();
|
return m_blockchain_storage.get_current_blockchain_height();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_blockchain_top(uint64_t& height, crypto::hash& top_id)
|
bool core::get_blockchain_top(uint64_t& height, crypto::hash& top_id) const
|
||||||
{
|
{
|
||||||
top_id = m_blockchain_storage.get_tail_id(height);
|
top_id = m_blockchain_storage.get_tail_id(height);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks, std::list<transaction>& txs)
|
bool core::get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks, std::list<transaction>& txs) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_blocks(start_offset, count, blocks, txs);
|
return m_blockchain_storage.get_blocks(start_offset, count, blocks, txs);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks)
|
bool core::get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_blocks(start_offset, count, blocks);
|
return m_blockchain_storage.get_blocks(start_offset, count, blocks);
|
||||||
} //-----------------------------------------------------------------------------------------------
|
} //-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<transaction>& txs, std::list<crypto::hash>& missed_txs)
|
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<transaction>& txs, std::list<crypto::hash>& missed_txs) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs);
|
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_alternative_blocks(std::list<block>& blocks)
|
bool core::get_alternative_blocks(std::list<block>& blocks) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_alternative_blocks(blocks);
|
return m_blockchain_storage.get_alternative_blocks(blocks);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
size_t core::get_alternative_blocks_count()
|
size_t core::get_alternative_blocks_count() const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_alternative_blocks_count();
|
return m_blockchain_storage.get_alternative_blocks_count();
|
||||||
}
|
}
|
||||||
@ -385,12 +385,12 @@ namespace cryptonote
|
|||||||
m_test_drop_download_height = height;
|
m_test_drop_download_height = height;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_test_drop_download()
|
bool core::get_test_drop_download() const
|
||||||
{
|
{
|
||||||
return m_test_drop_download;
|
return m_test_drop_download;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_test_drop_download_height()
|
bool core::get_test_drop_download_height() const
|
||||||
{
|
{
|
||||||
if (m_test_drop_download_height == 0)
|
if (m_test_drop_download_height == 0)
|
||||||
return true;
|
return true;
|
||||||
@ -451,7 +451,7 @@ namespace cryptonote
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_stat_info(core_stat_info& st_inf)
|
bool core::get_stat_info(core_stat_info& st_inf) const
|
||||||
{
|
{
|
||||||
st_inf.mining_speed = m_miner.get_speed();
|
st_inf.mining_speed = m_miner.get_speed();
|
||||||
st_inf.alternative_blocks = m_blockchain_storage.get_alternative_blocks_count();
|
st_inf.alternative_blocks = m_blockchain_storage.get_alternative_blocks_count();
|
||||||
@ -462,7 +462,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::check_tx_semantic(const transaction& tx, bool keeped_by_block)
|
bool core::check_tx_semantic(const transaction& tx, bool keeped_by_block) const
|
||||||
{
|
{
|
||||||
if(!tx.vin.size())
|
if(!tx.vin.size())
|
||||||
{
|
{
|
||||||
@ -515,12 +515,12 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::is_key_image_spent(const crypto::key_image &key_image)
|
bool core::is_key_image_spent(const crypto::key_image &key_image) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.have_tx_keyimg_as_spent(key_image);
|
return m_blockchain_storage.have_tx_keyimg_as_spent(key_image);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent)
|
bool core::are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent) const
|
||||||
{
|
{
|
||||||
spent.clear();
|
spent.clear();
|
||||||
BOOST_FOREACH(auto& ki, key_im)
|
BOOST_FOREACH(auto& ki, key_im)
|
||||||
@ -530,7 +530,7 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::check_tx_inputs_keyimages_diff(const transaction& tx)
|
bool core::check_tx_inputs_keyimages_diff(const transaction& tx) const
|
||||||
{
|
{
|
||||||
std::unordered_set<crypto::key_image> ki;
|
std::unordered_set<crypto::key_image> ki;
|
||||||
BOOST_FOREACH(const auto& in, tx.vin)
|
BOOST_FOREACH(const auto& in, tx.vin)
|
||||||
@ -551,7 +551,7 @@ namespace cryptonote
|
|||||||
return add_new_tx(tx, tx_hash, tx_prefix_hash, bl.size(), tvc, keeped_by_block);
|
return add_new_tx(tx, tx_hash, tx_prefix_hash, bl.size(), tvc, keeped_by_block);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
size_t core::get_blockchain_total_transactions()
|
size_t core::get_blockchain_total_transactions() const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_total_transactions();
|
return m_blockchain_storage.get_total_transactions();
|
||||||
}
|
}
|
||||||
@ -583,22 +583,22 @@ namespace cryptonote
|
|||||||
return m_blockchain_storage.create_block_template(b, adr, diffic, height, ex_nonce);
|
return m_blockchain_storage.create_block_template(b, adr, diffic, height, ex_nonce);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp)
|
bool core::find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.find_blockchain_supplement(qblock_ids, resp);
|
return m_blockchain_storage.find_blockchain_supplement(qblock_ids, resp);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count)
|
bool core::find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.find_blockchain_supplement(req_start_block, qblock_ids, blocks, total_height, start_height, max_count);
|
return m_blockchain_storage.find_blockchain_supplement(req_start_block, qblock_ids, blocks, total_height, start_height, max_count);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
void core::print_blockchain(uint64_t start_index, uint64_t end_index)
|
void core::print_blockchain(uint64_t start_index, uint64_t end_index) const
|
||||||
{
|
{
|
||||||
m_blockchain_storage.print_blockchain(start_index, end_index);
|
m_blockchain_storage.print_blockchain(start_index, end_index);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
void core::print_blockchain_index()
|
void core::print_blockchain_index() const
|
||||||
{
|
{
|
||||||
m_blockchain_storage.print_blockchain_index();
|
m_blockchain_storage.print_blockchain_index();
|
||||||
}
|
}
|
||||||
@ -608,12 +608,12 @@ namespace cryptonote
|
|||||||
m_blockchain_storage.print_blockchain_outs(file);
|
m_blockchain_storage.print_blockchain_outs(file);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
|
bool core::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_random_outs_for_amounts(req, res);
|
return m_blockchain_storage.get_random_outs_for_amounts(req, res);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs)
|
bool core::get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_tx_outputs_gindexs(tx_id, indexs);
|
return m_blockchain_storage.get_tx_outputs_gindexs(tx_id, indexs);
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ namespace cryptonote
|
|||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
// Used by the RPC server to check the size of an incoming
|
// Used by the RPC server to check the size of an incoming
|
||||||
// block_blob
|
// block_blob
|
||||||
bool core::check_incoming_block_size(const blobdata& block_blob)
|
bool core::check_incoming_block_size(const blobdata& block_blob) const
|
||||||
{
|
{
|
||||||
if(block_blob.size() > get_max_block_size())
|
if(block_blob.size() > get_max_block_size())
|
||||||
{
|
{
|
||||||
@ -738,32 +738,32 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
crypto::hash core::get_tail_id()
|
crypto::hash core::get_tail_id() const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_tail_id();
|
return m_blockchain_storage.get_tail_id();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
size_t core::get_pool_transactions_count()
|
size_t core::get_pool_transactions_count() const
|
||||||
{
|
{
|
||||||
return m_mempool.get_transactions_count();
|
return m_mempool.get_transactions_count();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::have_block(const crypto::hash& id)
|
bool core::have_block(const crypto::hash& id) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.have_block(id);
|
return m_blockchain_storage.have_block(id);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::parse_tx_from_blob(transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash, const blobdata& blob)
|
bool core::parse_tx_from_blob(transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash, const blobdata& blob) const
|
||||||
{
|
{
|
||||||
return parse_and_validate_tx_from_blob(blob, tx, tx_hash, tx_prefix_hash);
|
return parse_and_validate_tx_from_blob(blob, tx, tx_hash, tx_prefix_hash);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::check_tx_syntax(const transaction& tx)
|
bool core::check_tx_syntax(const transaction& tx) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_pool_transactions(std::list<transaction>& txs)
|
bool core::get_pool_transactions(std::list<transaction>& txs) const
|
||||||
{
|
{
|
||||||
m_mempool.get_transactions(txs);
|
m_mempool.get_transactions(txs);
|
||||||
return true;
|
return true;
|
||||||
@ -774,7 +774,7 @@ namespace cryptonote
|
|||||||
return m_mempool.get_transactions_and_spent_keys_info(tx_infos, key_image_infos);
|
return m_mempool.get_transactions_and_spent_keys_info(tx_infos, key_image_infos);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_short_chain_history(std::list<crypto::hash>& ids)
|
bool core::get_short_chain_history(std::list<crypto::hash>& ids) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_short_chain_history(ids);
|
return m_blockchain_storage.get_short_chain_history(ids);
|
||||||
}
|
}
|
||||||
@ -784,12 +784,12 @@ namespace cryptonote
|
|||||||
return m_blockchain_storage.handle_get_objects(arg, rsp);
|
return m_blockchain_storage.handle_get_objects(arg, rsp);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
crypto::hash core::get_block_id_by_height(uint64_t height)
|
crypto::hash core::get_block_id_by_height(uint64_t height) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_block_id_by_height(height);
|
return m_blockchain_storage.get_block_id_by_height(height);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_block_by_hash(const crypto::hash &h, block &blk)
|
bool core::get_block_by_hash(const crypto::hash &h, block &blk) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_block_by_hash(h, blk);
|
return m_blockchain_storage.get_block_by_hash(h, blk);
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ namespace cryptonote
|
|||||||
// m_blockchain_storage.get_all_known_block_ids(main, alt, invalid);
|
// m_blockchain_storage.get_all_known_block_ids(main, alt, invalid);
|
||||||
//}
|
//}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
std::string core::print_pool(bool short_format)
|
std::string core::print_pool(bool short_format) const
|
||||||
{
|
{
|
||||||
return m_mempool.print_pool(short_format);
|
return m_mempool.print_pool(short_format);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace cryptonote
|
|||||||
bool prepare_handle_incoming_blocks(const std::list<block_complete_entry> &blocks);
|
bool prepare_handle_incoming_blocks(const std::list<block_complete_entry> &blocks);
|
||||||
bool cleanup_handle_incoming_blocks(bool force_sync = false);
|
bool cleanup_handle_incoming_blocks(bool force_sync = false);
|
||||||
|
|
||||||
bool check_incoming_block_size(const blobdata& block_blob);
|
bool check_incoming_block_size(const blobdata& block_blob) const;
|
||||||
i_cryptonote_protocol* get_protocol(){return m_pprotocol;}
|
i_cryptonote_protocol* get_protocol(){return m_pprotocol;}
|
||||||
|
|
||||||
//-------------------- i_miner_handler -----------------------
|
//-------------------- i_miner_handler -----------------------
|
||||||
@ -78,6 +78,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
|
|
||||||
miner& get_miner(){return m_miner;}
|
miner& get_miner(){return m_miner;}
|
||||||
|
const miner& get_miner()const{return m_miner;}
|
||||||
static void init_options(boost::program_options::options_description& desc);
|
static void init_options(boost::program_options::options_description& desc);
|
||||||
bool init(const boost::program_options::variables_map& vm);
|
bool init(const boost::program_options::variables_map& vm);
|
||||||
bool set_genesis_block(const block& b);
|
bool set_genesis_block(const block& b);
|
||||||
@ -86,55 +87,57 @@ namespace cryptonote
|
|||||||
static bool get_fast_exit();
|
static bool get_fast_exit();
|
||||||
void test_drop_download();
|
void test_drop_download();
|
||||||
void test_drop_download_height(uint64_t height);
|
void test_drop_download_height(uint64_t height);
|
||||||
bool get_test_drop_download();
|
bool get_test_drop_download() const;
|
||||||
bool get_test_drop_download_height();
|
bool get_test_drop_download_height() const;
|
||||||
uint64_t get_current_blockchain_height();
|
uint64_t get_current_blockchain_height() const;
|
||||||
bool get_blockchain_top(uint64_t& heeight, crypto::hash& top_id);
|
bool get_blockchain_top(uint64_t& heeight, crypto::hash& top_id) const;
|
||||||
bool get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks, std::list<transaction>& txs);
|
bool get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks, std::list<transaction>& txs) const;
|
||||||
bool get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks);
|
bool get_blocks(uint64_t start_offset, size_t count, std::list<block>& blocks) const;
|
||||||
template<class t_ids_container, class t_blocks_container, class t_missed_container>
|
template<class t_ids_container, class t_blocks_container, class t_missed_container>
|
||||||
bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs)
|
bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_blocks(block_ids, blocks, missed_bs);
|
return m_blockchain_storage.get_blocks(block_ids, blocks, missed_bs);
|
||||||
}
|
}
|
||||||
crypto::hash get_block_id_by_height(uint64_t height);
|
crypto::hash get_block_id_by_height(uint64_t height) const;
|
||||||
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<transaction>& txs, std::list<crypto::hash>& missed_txs);
|
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<transaction>& txs, std::list<crypto::hash>& missed_txs) const;
|
||||||
bool get_block_by_hash(const crypto::hash &h, block &blk);
|
bool get_block_by_hash(const crypto::hash &h, block &blk) const;
|
||||||
//void get_all_known_block_ids(std::list<crypto::hash> &main, std::list<crypto::hash> &alt, std::list<crypto::hash> &invalid);
|
//void get_all_known_block_ids(std::list<crypto::hash> &main, std::list<crypto::hash> &alt, std::list<crypto::hash> &invalid);
|
||||||
|
|
||||||
bool get_alternative_blocks(std::list<block>& blocks);
|
bool get_alternative_blocks(std::list<block>& blocks) const;
|
||||||
size_t get_alternative_blocks_count();
|
size_t get_alternative_blocks_count() const;
|
||||||
|
|
||||||
void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol);
|
void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol);
|
||||||
void set_checkpoints(checkpoints&& chk_pts);
|
void set_checkpoints(checkpoints&& chk_pts);
|
||||||
void set_checkpoints_file_path(const std::string& path);
|
void set_checkpoints_file_path(const std::string& path);
|
||||||
void set_enforce_dns_checkpoints(bool enforce_dns);
|
void set_enforce_dns_checkpoints(bool enforce_dns);
|
||||||
|
|
||||||
bool get_pool_transactions(std::list<transaction>& txs);
|
bool get_pool_transactions(std::list<transaction>& txs) const;
|
||||||
bool get_pool_transactions_and_spent_keys_info(std::vector<tx_info>& tx_infos, std::vector<spent_key_image_info>& key_image_infos) const;
|
bool get_pool_transactions_and_spent_keys_info(std::vector<tx_info>& tx_infos, std::vector<spent_key_image_info>& key_image_infos) const;
|
||||||
size_t get_pool_transactions_count();
|
size_t get_pool_transactions_count() const;
|
||||||
size_t get_blockchain_total_transactions();
|
size_t get_blockchain_total_transactions() const;
|
||||||
//bool get_outs(uint64_t amount, std::list<crypto::public_key>& pkeys);
|
//bool get_outs(uint64_t amount, std::list<crypto::public_key>& pkeys);
|
||||||
bool have_block(const crypto::hash& id);
|
bool have_block(const crypto::hash& id) const;
|
||||||
bool get_short_chain_history(std::list<crypto::hash>& ids);
|
bool get_short_chain_history(std::list<crypto::hash>& ids) const;
|
||||||
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp);
|
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const;
|
||||||
bool find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count);
|
bool find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count) const;
|
||||||
bool get_stat_info(core_stat_info& st_inf);
|
bool get_stat_info(core_stat_info& st_inf) const;
|
||||||
//bool get_backward_blocks_sizes(uint64_t from_height, std::vector<size_t>& sizes, size_t count);
|
//bool get_backward_blocks_sizes(uint64_t from_height, std::vector<size_t>& sizes, size_t count);
|
||||||
bool get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs);
|
bool get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs) const;
|
||||||
crypto::hash get_tail_id();
|
crypto::hash get_tail_id() const;
|
||||||
bool get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res);
|
bool get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res) const;
|
||||||
void pause_mine();
|
void pause_mine();
|
||||||
void resume_mine();
|
void resume_mine();
|
||||||
#if BLOCKCHAIN_DB == DB_LMDB
|
#if BLOCKCHAIN_DB == DB_LMDB
|
||||||
Blockchain& get_blockchain_storage(){return m_blockchain_storage;}
|
Blockchain& get_blockchain_storage(){return m_blockchain_storage;}
|
||||||
|
const Blockchain& get_blockchain_storage()const{return m_blockchain_storage;}
|
||||||
#else
|
#else
|
||||||
blockchain_storage& get_blockchain_storage(){return m_blockchain_storage;}
|
blockchain_storage& get_blockchain_storage(){return m_blockchain_storage;}
|
||||||
|
const blockchain_storage& get_blockchain_storage()const{return m_blockchain_storage;}
|
||||||
#endif
|
#endif
|
||||||
//debug functions
|
//debug functions
|
||||||
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
void print_blockchain(uint64_t start_index, uint64_t end_index) const;
|
||||||
void print_blockchain_index();
|
void print_blockchain_index() const;
|
||||||
std::string print_pool(bool short_format);
|
std::string print_pool(bool short_format) const;
|
||||||
void print_blockchain_outs(const std::string& file);
|
void print_blockchain_outs(const std::string& file);
|
||||||
void on_synchronized();
|
void on_synchronized();
|
||||||
|
|
||||||
@ -145,27 +148,27 @@ namespace cryptonote
|
|||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
bool is_key_image_spent(const crypto::key_image& key_im);
|
bool is_key_image_spent(const crypto::key_image& key_im) const;
|
||||||
bool are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent);
|
bool are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool add_new_block(const block& b, block_verification_context& bvc);
|
bool add_new_block(const block& b, block_verification_context& bvc);
|
||||||
bool load_state_data();
|
bool load_state_data();
|
||||||
bool parse_tx_from_blob(transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash, const blobdata& blob);
|
bool parse_tx_from_blob(transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash, const blobdata& blob) const;
|
||||||
|
|
||||||
bool check_tx_syntax(const transaction& tx);
|
bool check_tx_syntax(const transaction& tx) const;
|
||||||
//check correct values, amounts and all lightweight checks not related with database
|
//check correct values, amounts and all lightweight checks not related with database
|
||||||
bool check_tx_semantic(const transaction& tx, bool keeped_by_block);
|
bool check_tx_semantic(const transaction& tx, bool keeped_by_block) const;
|
||||||
//check if tx already in memory pool or in main blockchain
|
//check if tx already in memory pool or in main blockchain
|
||||||
|
|
||||||
bool check_tx_ring_signature(const txin_to_key& tx, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig);
|
bool check_tx_ring_signature(const txin_to_key& tx, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig) const;
|
||||||
bool is_tx_spendtime_unlocked(uint64_t unlock_time);
|
bool is_tx_spendtime_unlocked(uint64_t unlock_time) const;
|
||||||
bool update_miner_block_template();
|
bool update_miner_block_template();
|
||||||
bool handle_command_line(const boost::program_options::variables_map& vm);
|
bool handle_command_line(const boost::program_options::variables_map& vm);
|
||||||
bool on_update_blocktemplate_interval();
|
bool on_update_blocktemplate_interval();
|
||||||
bool check_tx_inputs_keyimages_diff(const transaction& tx);
|
bool check_tx_inputs_keyimages_diff(const transaction& tx) const;
|
||||||
void graceful_exit();
|
void graceful_exit();
|
||||||
bool check_fork_time();
|
bool check_fork_time();
|
||||||
static std::atomic<bool> m_fast_exit;
|
static std::atomic<bool> m_fast_exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user