aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-08-01 17:31:15 +0200
committerRiccardo Spagni <ric@spagni.net>2014-08-01 17:31:15 +0200
commitd1b0ee7ecdd25a1aeeab2f4dc0d610fce1acd116 (patch)
treeb2c3906b001d3b9d9dc7053d91957070d8b15d20 /src/cryptonote_core/tx_pool.h
parentMerge pull request #72 from fluffypony/master (diff)
parentRemove dead code (diff)
downloadmonero-d1b0ee7ecdd25a1aeeab2f4dc0d610fce1acd116.tar.xz
Merge pull request #64 from mikezackles/bytecoin_tx_pool_tmp
tx pool fixes, courtesy of Bytecoin
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r--src/cryptonote_core/tx_pool.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 0abb15fa9..7617765cc 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -61,28 +61,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_keyimg_as_spent(const crypto::key_image& key_im);
- bool have_tx_keyimges_as_spent(const transaction& tx);
-
+ 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<transaction>& 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<crypto::key_image>& kic, const transaction& tx);
- bool append_key_images(std::unordered_set<crypto::key_image>& kic, const transaction& tx);
- std::string print_pool(bool short_format);
+ void get_transactions(std::list<transaction>& 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);*/
@@ -115,11 +109,17 @@ namespace cryptonote
private:
bool remove_stuck_transactions();
- bool is_transaction_ready_to_go(tx_details& txd);
+ 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<crypto::key_image>& kic, const transaction& tx);
+ static bool append_key_images(std::unordered_set<crypto::key_image>& kic, const transaction& tx);
+
+ bool is_transaction_ready_to_go(tx_details& txd) const;
typedef std::unordered_map<crypto::hash, tx_details > transactions_container;
typedef std::unordered_map<crypto::key_image, std::unordered_set<crypto::hash> > 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;