aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Morcos <[email protected]>2015-11-03 10:02:20 -0500
committerAlex Morcos <[email protected]>2015-12-01 10:10:25 -0500
commit7230187b1d8bf39da5f1502e4c9eeb8e72dccdff (patch)
treecc87e1bd43bb3bd17c9df1d1523fb7b86b34f7c3 /src
parentAdd a score index to the mempool. (diff)
downloaddiscoin-7230187b1d8bf39da5f1502e4c9eeb8e72dccdff.tar.xz
discoin-7230187b1d8bf39da5f1502e4c9eeb8e72dccdff.zip
Add TxPriority class and comparator
Diffstat (limited to 'src')
-rw-r--r--src/txmempool.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index b011c3882..deeb2f7b6 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -587,4 +587,17 @@ public:
bool HaveCoins(const uint256 &txid) const;
};
+// We want to sort transactions by coin age priority
+typedef std::pair<double, CTxMemPool::txiter> TxCoinAgePriority;
+
+struct TxCoinAgePriorityCompare
+{
+ bool operator()(const TxCoinAgePriority& a, const TxCoinAgePriority& b)
+ {
+ if (a.first == b.first)
+ return CompareTxMemPoolEntryByScore()(*(b.second), *(a.second)); //Reverse order to make sort less than
+ return a.first < b.first;
+ }
+};
+
#endif // BITCOIN_TXMEMPOOL_H