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

#include <disconnected_transactions.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 removeForBlock (const std::vector< CTransactionRef > &vtx, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
 
void removeEntry (indexed_disconnected_transactions::index< insertion_order >::type::iterator entry)
 
bool isEmpty () const
 
void clear ()
 
void updateMempoolForReorg (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 45 of file disconnected_transactions.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 56 of file disconnected_transactions.h.

◆ TxInfoMap

Definition at line 70 of file disconnected_transactions.h.

Constructor & Destructor Documentation

◆ ~DisconnectedBlockTransactions()

DisconnectedBlockTransactions::~DisconnectedBlockTransactions ( )
inline

Definition at line 93 of file disconnected_transactions.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 81 of file disconnected_transactions.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 74 of file disconnected_transactions.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 147 of file disconnected_transactions.h.

◆ DynamicMemoryUsage()

size_t DisconnectedBlockTransactions::DynamicMemoryUsage ( ) const
inline

Definition at line 97 of file disconnected_transactions.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 104 of file disconnected_transactions.h.

◆ getTxInfo()

const DisconnectedBlockTransactions::TxInfo * 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 20 of file disconnected_transactions.cpp.

Here is the caller graph for this function:

◆ importMempool()

void DisconnectedBlockTransactions::importMempool ( CTxMemPool pool)

Definition at line 28 of file disconnected_transactions.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 145 of file disconnected_transactions.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 138 of file disconnected_transactions.h.

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

◆ removeForBlock() [1/2]

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

Definition at line 119 of file disconnected_transactions.h.

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

◆ removeForBlock() [2/2]

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

Definition at line 140 of file disconnected_transactions.cpp.

Here is the call graph for this function:

◆ updateMempoolForReorg()

void DisconnectedBlockTransactions::updateMempoolForReorg ( 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 174 of file disconnected_transactions.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 59 of file disconnected_transactions.h.

◆ cs

void pool DisconnectedBlockTransactions::cs

Definition at line 168 of file disconnected_transactions.h.

◆ queuedTx

indexed_disconnected_transactions DisconnectedBlockTransactions::queuedTx
private

Definition at line 58 of file disconnected_transactions.h.

◆ txInfo

TxInfoMap DisconnectedBlockTransactions::txInfo
private

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

Definition at line 72 of file disconnected_transactions.h.


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