Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show First 20 Lines • Show All 765 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* CCoinsView that brings transactions from a memorypool into view. | * CCoinsView that brings transactions from a memorypool into view. | ||||
* It does not check for spendings by memory pool transactions. | * It does not check for spendings by memory pool transactions. | ||||
*/ | */ | ||||
class CCoinsViewMemPool : public CCoinsViewBacked { | class CCoinsViewMemPool : public CCoinsViewBacked { | ||||
protected: | protected: | ||||
const CTxMemPool &mempool; | const CTxMemPool &mempool; | ||||
bool HaveCoins(const uint256 &txid) const; | |||||
public: | public: | ||||
CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn); | CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn); | ||||
bool GetCoins(const uint256 &txid, CCoins &coins) const; | bool GetCoins(const uint256 &txid, CCoins &coins) const; | ||||
bool HaveCoins(const uint256 &txid) const; | |||||
}; | }; | ||||
// We want to sort transactions by coin age priority | // We want to sort transactions by coin age priority | ||||
typedef std::pair<double, CTxMemPool::txiter> TxCoinAgePriority; | typedef std::pair<double, CTxMemPool::txiter> TxCoinAgePriority; | ||||
struct TxCoinAgePriorityCompare { | struct TxCoinAgePriorityCompare { | ||||
bool operator()(const TxCoinAgePriority &a, const TxCoinAgePriority &b) { | bool operator()(const TxCoinAgePriority &a, const TxCoinAgePriority &b) { | ||||
if (a.first == b.first) { | if (a.first == b.first) { | ||||
// Reverse order to make sort less than | // Reverse order to make sort less than | ||||
return CompareTxMemPoolEntryByScore()(*(b.second), *(a.second)); | return CompareTxMemPoolEntryByScore()(*(b.second), *(a.second)); | ||||
} | } | ||||
return a.first < b.first; | return a.first < b.first; | ||||
} | } | ||||
}; | }; | ||||
#endif // BITCOIN_TXMEMPOOL_H | #endif // BITCOIN_TXMEMPOOL_H |