aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.h
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2015-05-13 20:27:06 -0400
committerThomas Winget <tewinget@gmail.com>2015-05-13 20:27:06 -0400
commitb1d92bcc371dbfeda7d245ef74e716f49d8c87d2 (patch)
treeb4008eb1ccb9220f4fe00c420a34a0801ad69d9b /src/cryptonote_core/tx_pool.h
parentMerge pull request #281 (diff)
downloadmonero-b1d92bcc371dbfeda7d245ef74e716f49d8c87d2.tar.xz
Fixes changes to sort tx by fee per kb
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r--src/cryptonote_core/tx_pool.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 7c8f4a449..0110bb8cd 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -57,6 +57,22 @@ namespace cryptonote
/* */
/************************************************************************/
+ typedef std::pair<double, crypto::hash> tx_by_fee_entry;
+ class txCompare
+ {
+ public:
+ bool operator()(const tx_by_fee_entry& a, const tx_by_fee_entry& b)
+ {
+ // sort by greatest first, not least
+ if (a.first > b.first) return true;
+ else if (a.first < b.first) return false;
+ else if (a.second != b.second) return true;
+ else return false;
+ }
+ };
+
+ typedef std::set<tx_by_fee_entry, txCompare> sorted_tx_container;
+
class tx_memory_pool: boost::noncopyable
{
public:
@@ -134,11 +150,11 @@ namespace cryptonote
key_images_container m_spent_key_images;
epee::math_helper::once_a_time_seconds<30> m_remove_stuck_tx_interval;
- typedef std::unordered_map<crypto::hash, double> tx_by_fee_entry;
-
//TODO: add fee_per_kb element to type tx_details and replace this
//functionality by just making m_transactions a std::set
- std::set<tx_by_fee_entry> m_txs_by_fee;
+ sorted_tx_container m_txs_by_fee;
+
+ sorted_tx_container::iterator find_tx_in_sorted_container(const crypto::hash& id) const;
//transactions_container m_alternative_transactions;