Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
}; | }; | ||||
// Multi_index tag names | // Multi_index tag names | ||||
struct descendant_score {}; | struct descendant_score {}; | ||||
struct entry_time {}; | struct entry_time {}; | ||||
struct mining_score {}; | struct mining_score {}; | ||||
struct ancestor_score {}; | struct ancestor_score {}; | ||||
struct txid_index {}; | |||||
struct insertion_order {}; | |||||
/** | /** | ||||
* Information about a mempool transaction. | * Information about a mempool transaction. | ||||
*/ | */ | ||||
struct TxMempoolInfo { | struct TxMempoolInfo { | ||||
/** The transaction itself */ | /** The transaction itself */ | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | typedef boost::multi_index_container< | ||||
boost::multi_index::ordered_unique< | boost::multi_index::ordered_unique< | ||||
boost::multi_index::tag<mining_score>, | boost::multi_index::tag<mining_score>, | ||||
boost::multi_index::identity<CTxMemPoolEntry>, | boost::multi_index::identity<CTxMemPoolEntry>, | ||||
CompareTxMemPoolEntryByScore>, | CompareTxMemPoolEntryByScore>, | ||||
// sorted by fee rate with ancestors | // sorted by fee rate with ancestors | ||||
boost::multi_index::ordered_non_unique< | boost::multi_index::ordered_non_unique< | ||||
boost::multi_index::tag<ancestor_score>, | boost::multi_index::tag<ancestor_score>, | ||||
boost::multi_index::identity<CTxMemPoolEntry>, | boost::multi_index::identity<CTxMemPoolEntry>, | ||||
CompareTxMemPoolEntryByAncestorFee>>> | CompareTxMemPoolEntryByAncestorFee>, | ||||
boost::multi_index::sequenced< | |||||
boost::multi_index::tag<insertion_order>>>> | |||||
indexed_transaction_set; | indexed_transaction_set; | ||||
mutable CCriticalSection cs; | mutable CCriticalSection cs; | ||||
indexed_transaction_set mapTx; | indexed_transaction_set mapTx; | ||||
typedef indexed_transaction_set::nth_index<0>::type::iterator txiter; | typedef indexed_transaction_set::nth_index<0>::type::iterator txiter; | ||||
//!< All tx hashes/entries in mapTx, in random order | //!< All tx hashes/entries in mapTx, in random order | ||||
std::vector<std::pair<uint256, txiter>> vTxHashes; | std::vector<std::pair<uint256, txiter>> vTxHashes; | ||||
▲ Show 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | |||||
* Instead, store the disconnected transactions (in order!) as we go, remove any | * Instead, store the disconnected transactions (in order!) as we go, remove any | ||||
* that are included in blocks in the new chain, and then process the remaining | * that are included in blocks in the new chain, and then process the remaining | ||||
* still-unconfirmed transactions at the end. | * still-unconfirmed transactions at the end. | ||||
* | * | ||||
* It also enables efficient reprocessing of current mempool entries, useful | * It also enables efficient reprocessing of current mempool entries, useful | ||||
* when (de)activating forks that result in in-mempool transactions becoming | * when (de)activating forks that result in in-mempool transactions becoming | ||||
* invalid | * invalid | ||||
*/ | */ | ||||
// multi_index tag names | |||||
struct txid_index {}; | |||||
struct insertion_order {}; | |||||
class DisconnectedBlockTransactions { | class DisconnectedBlockTransactions { | ||||
private: | private: | ||||
typedef boost::multi_index_container< | typedef boost::multi_index_container< | ||||
CTransactionRef, boost::multi_index::indexed_by< | CTransactionRef, boost::multi_index::indexed_by< | ||||
// sorted by txid | // sorted by txid | ||||
boost::multi_index::hashed_unique< | boost::multi_index::hashed_unique< | ||||
boost::multi_index::tag<txid_index>, | boost::multi_index::tag<txid_index>, | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |