Skip to content

Commit 7230187

Browse files
committed
Add TxPriority class and comparator
1 parent f3fe836 commit 7230187

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/txmempool.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,4 +587,17 @@ class CCoinsViewMemPool : public CCoinsViewBacked
587587
bool HaveCoins(const uint256 &txid) const;
588588
};
589589

590+
// We want to sort transactions by coin age priority
591+
typedef std::pair<double, CTxMemPool::txiter> TxCoinAgePriority;
592+
593+
struct TxCoinAgePriorityCompare
594+
{
595+
bool operator()(const TxCoinAgePriority& a, const TxCoinAgePriority& b)
596+
{
597+
if (a.first == b.first)
598+
return CompareTxMemPoolEntryByScore()(*(b.second), *(a.second)); //Reverse order to make sort less than
599+
return a.first < b.first;
600+
}
601+
};
602+
590603
#endif // BITCOIN_TXMEMPOOL_H

0 commit comments

Comments
 (0)