From 7230187b1d8bf39da5f1502e4c9eeb8e72dccdff Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Tue, 3 Nov 2015 10:02:20 -0500 Subject: [PATCH] Add TxPriority class and comparator --- src/txmempool.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 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