Bitcoin ABC  0.26.3
P2P Digital Currency
Classes | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
DisconnectedBlockTransactions Class Reference

#include <txmempool.h>

Classes

struct  TxInfo
 

Public Member Functions

 ~DisconnectedBlockTransactions ()
 
size_t DynamicMemoryUsage () const
 
const indexed_disconnected_transactionsGetQueuedTx () const
 
void importMempool (CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
 
void addForBlock (const std::vector< CTransactionRef > &vtx, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
 
void removeForBlock (const std::vector< CTransactionRef > &vtx)
 
void removeEntry (indexed_disconnected_transactions::index< insertion_order >::type::iterator entry)
 
bool isEmpty () const
 
void clear ()
 
void updateMempoolForReorg (const Config &config, Chainstate &active_chainstate, bool fAddToMempool, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main
 Make mempool consistent after a reorg, by re-adding or recursively erasing disconnected block transactions from the mempool, and also removing any other transactions from the mempool that are no longer valid given the new tip/height. More...
 

Public Attributes

void pool cs
 

Private Types

typedef boost::multi_index_container< CTransactionRef, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< txid_index >, mempoolentry_txid, SaltedTxIdHasher >, boost::multi_index::sequenced< boost::multi_index::tag< insertion_order > > > > indexed_disconnected_transactions
 
using TxInfoMap = std::unordered_map< TxId, TxInfo, SaltedTxIdHasher >
 

Private Member Functions

void addTransaction (const CTransactionRef &tx)
 
const TxInfogetTxInfo (const CTransactionRef &tx) const
 

Private Attributes

indexed_disconnected_transactions queuedTx
 
uint64_t cachedInnerUsage = 0
 
TxInfoMap txInfo
 populated by importMempool(); the original tx entry times and feeDeltas More...
 

Detailed Description

Definition at line 727 of file txmempool.h.

Member Typedef Documentation

◆ indexed_disconnected_transactions

typedef boost::multi_index_container< CTransactionRef, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag<txid_index>, mempoolentry_txid, SaltedTxIdHasher>, boost::multi_index::sequenced< boost::multi_index::tag<insertion_order> > > > DisconnectedBlockTransactions::indexed_disconnected_transactions
private

Definition at line 738 of file txmempool.h.

◆ TxInfoMap

Definition at line 752 of file txmempool.h.

Constructor & Destructor Documentation

◆ ~DisconnectedBlockTransactions()

DisconnectedBlockTransactions::~DisconnectedBlockTransactions ( )
inline

Definition at line 775 of file txmempool.h.

Here is the call graph for this function:

Member Function Documentation

◆ addForBlock()

void DisconnectedBlockTransactions::addForBlock ( const std::vector< CTransactionRef > &  vtx,
CTxMemPool pool 
)

Definition at line 853 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTransaction()

void DisconnectedBlockTransactions::addTransaction ( const CTransactionRef tx)
inlineprivate

Definition at line 756 of file txmempool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void DisconnectedBlockTransactions::clear ( )
inline

Definition at line 826 of file txmempool.h.

Here is the caller graph for this function:

◆ DynamicMemoryUsage()

size_t DisconnectedBlockTransactions::DynamicMemoryUsage ( ) const
inline

Definition at line 779 of file txmempool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetQueuedTx()

const indexed_disconnected_transactions& DisconnectedBlockTransactions::GetQueuedTx ( ) const
inline

Definition at line 786 of file txmempool.h.

Here is the caller graph for this function:

◆ getTxInfo()

auto DisconnectedBlockTransactions::getTxInfo ( const CTransactionRef tx) const
private
Returns
a pointer into the txInfo map if tx->GetId() exists in the map, or nullptr otherwise. Note that the returned pointer is only valid for as long as its underlying map node is valid.

Definition at line 961 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importMempool()

void DisconnectedBlockTransactions::importMempool ( CTxMemPool pool)

Definition at line 912 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

bool DisconnectedBlockTransactions::isEmpty ( ) const
inline

Definition at line 824 of file txmempool.h.

Here is the caller graph for this function:

◆ removeEntry()

void DisconnectedBlockTransactions::removeEntry ( indexed_disconnected_transactions::index< insertion_order >::type::iterator  entry)
inline

Definition at line 817 of file txmempool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeForBlock()

void DisconnectedBlockTransactions::removeForBlock ( const std::vector< CTransactionRef > &  vtx)
inline

Definition at line 801 of file txmempool.h.

Here is the call graph for this function:

◆ updateMempoolForReorg()

void DisconnectedBlockTransactions::updateMempoolForReorg ( const Config config,
Chainstate active_chainstate,
bool  fAddToMempool,
CTxMemPool pool 
)

Make mempool consistent after a reorg, by re-adding or recursively erasing disconnected block transactions from the mempool, and also removing any other transactions from the mempool that are no longer valid given the new tip/height.

Note: we assume that disconnectpool only contains transactions that are NOT confirmed in the current chain nor already in the mempool (otherwise, in-mempool descendants of such transactions would be removed).

Passing fAddToMempool=false will skip trying to add the transactions back, and instead just erase from the mempool as needed.

Definition at line 970 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cachedInnerUsage

uint64_t DisconnectedBlockTransactions::cachedInnerUsage = 0
private

Definition at line 741 of file txmempool.h.

◆ cs

void pool DisconnectedBlockTransactions::cs

Definition at line 848 of file txmempool.h.

◆ queuedTx

indexed_disconnected_transactions DisconnectedBlockTransactions::queuedTx
private

Definition at line 740 of file txmempool.h.

◆ txInfo

TxInfoMap DisconnectedBlockTransactions::txInfo
private

populated by importMempool(); the original tx entry times and feeDeltas

Definition at line 754 of file txmempool.h.


The documentation for this class was generated from the following files: