diff options
author | Alex Morcos <morcos@chaincode.com> | 2015-11-03 10:02:20 -0500 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2015-12-01 10:10:25 -0500 |
commit | 7230187b1d8bf39da5f1502e4c9eeb8e72dccdff (patch) | |
tree | cc87e1bd43bb3bd17c9df1d1523fb7b86b34f7c3 | |
parent | f3fe83673e84ef4d20b3026faa397cad17212ff8 (diff) |
Add TxPriority class and comparator
-rw-r--r-- | src/txmempool.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index b011c38827..deeb2f7b62 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 |