From 85a04cb16866b66df4330e7ee770793cf6b2cf53 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Thu, 17 Jul 2014 10:27:37 -0400 Subject: Make some tx_pool methods private --- src/cryptonote_core/tx_pool.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/cryptonote_core/tx_pool.h') diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 649af41a3..72eff378d 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -36,9 +36,6 @@ namespace cryptonote bool take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee); bool have_tx(const crypto::hash &id); - bool have_tx_keyimg_as_spent(const crypto::key_image& key_im); - bool have_tx_keyimges_as_spent(const transaction& tx); - bool on_blockchain_inc(uint64_t new_block_height, const crypto::hash& top_block_id); bool on_blockchain_dec(uint64_t new_block_height, const crypto::hash& top_block_id); void on_idle(); @@ -53,9 +50,6 @@ namespace cryptonote bool get_transactions(std::list& txs); bool get_transaction(const crypto::hash& h, transaction& tx); size_t get_transactions_count(); - bool remove_transaction_keyimages(const transaction& tx); - bool have_key_images(const std::unordered_set& kic, const transaction& tx); - bool append_key_images(std::unordered_set& kic, const transaction& tx); std::string print_pool(bool short_format); /*bool flush_pool(const std::strig& folder); @@ -89,6 +83,12 @@ namespace cryptonote private: bool remove_stuck_transactions(); + bool have_tx_keyimg_as_spent(const crypto::key_image& key_im); + bool have_tx_keyimges_as_spent(const transaction& tx); + bool remove_transaction_keyimages(const transaction& tx); + bool have_key_images(const std::unordered_set& kic, const transaction& tx); + bool append_key_images(std::unordered_set& kic, const transaction& tx); + bool is_transaction_ready_to_go(tx_details& txd); typedef std::unordered_map transactions_container; typedef std::unordered_map > key_images_container; -- cgit v1.2.3 From 9872d205ff8fb1c961cd335c760ebf238c25ab9a Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Thu, 17 Jul 2014 10:47:17 -0400 Subject: Make some tx_pool methods static --- src/cryptonote_core/tx_pool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cryptonote_core/tx_pool.h') diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 72eff378d..6bb6189ec 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -86,8 +86,8 @@ namespace cryptonote bool have_tx_keyimg_as_spent(const crypto::key_image& key_im); bool have_tx_keyimges_as_spent(const transaction& tx); bool remove_transaction_keyimages(const transaction& tx); - bool have_key_images(const std::unordered_set& kic, const transaction& tx); - bool append_key_images(std::unordered_set& kic, const transaction& tx); + static bool have_key_images(const std::unordered_set& kic, const transaction& tx); + static bool append_key_images(std::unordered_set& kic, const transaction& tx); bool is_transaction_ready_to_go(tx_details& txd); typedef std::unordered_map transactions_container; -- cgit v1.2.3 From 4d25350a823866a602dca84847f7d7e3b810c823 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Thu, 17 Jul 2014 10:31:44 -0400 Subject: Use const where appropriate in tx_pool --- src/cryptonote_core/tx_pool.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/cryptonote_core/tx_pool.h') diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 6bb6189ec..91fc18b5b 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -35,22 +35,22 @@ namespace cryptonote //gets tx and remove it from pool bool take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee); - bool have_tx(const crypto::hash &id); + bool have_tx(const crypto::hash &id) const; bool on_blockchain_inc(uint64_t new_block_height, const crypto::hash& top_block_id); bool on_blockchain_dec(uint64_t new_block_height, const crypto::hash& top_block_id); void on_idle(); - void lock(); - void unlock(); + void lock() const; + void unlock() const; // load/store operations bool init(const std::string& config_folder); bool deinit(); bool fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee); - bool get_transactions(std::list& txs); - bool get_transaction(const crypto::hash& h, transaction& tx); - size_t get_transactions_count(); - std::string print_pool(bool short_format); + void get_transactions(std::list& txs) const; + bool get_transaction(const crypto::hash& h, transaction& tx) const; + size_t get_transactions_count() const; + std::string print_pool(bool short_format) const; /*bool flush_pool(const std::strig& folder); bool inflate_pool(const std::strig& folder);*/ @@ -83,17 +83,17 @@ namespace cryptonote private: bool remove_stuck_transactions(); - bool have_tx_keyimg_as_spent(const crypto::key_image& key_im); - bool have_tx_keyimges_as_spent(const transaction& tx); + bool have_tx_keyimg_as_spent(const crypto::key_image& key_im) const; + bool have_tx_keyimges_as_spent(const transaction& tx) const; bool remove_transaction_keyimages(const transaction& tx); static bool have_key_images(const std::unordered_set& kic, const transaction& tx); static bool append_key_images(std::unordered_set& kic, const transaction& tx); - bool is_transaction_ready_to_go(tx_details& txd); + bool is_transaction_ready_to_go(tx_details& txd) const; typedef std::unordered_map transactions_container; typedef std::unordered_map > key_images_container; - epee::critical_section m_transactions_lock; + mutable epee::critical_section m_transactions_lock; transactions_container m_transactions; key_images_container m_spent_key_images; epee::math_helper::once_a_time_seconds<30> m_remove_stuck_tx_interval; -- cgit v1.2.3