6#ifndef BITCOIN_KERNEL_DISCONNECTED_TRANSACTIONS_H
7#define BITCOIN_KERNEL_DISCONNECTED_TRANSACTIONS_H
15#include <boost/multi_index/hashed_index.hpp>
16#include <boost/multi_index/sequenced_index.hpp>
17#include <boost/multi_index_container.hpp>
20#include <unordered_map>
47 typedef boost::multi_index_container<
50 boost::multi_index::hashed_unique<
51 boost::multi_index::tag<txid_index>,
54 boost::multi_index::sequenced<
55 boost::multi_index::tag<insertion_order>>>>
62 const std::chrono::seconds
time;
66 unsigned height_) noexcept
70 using TxInfoMap = std::unordered_map<TxId, TxInfo, SaltedTxIdHasher>;
124 for (
auto const &tx : vtx) {
125 auto it =
queuedTx.find(tx->GetId());
129 txInfo.erase(tx->GetId());
141 txInfo.erase((*entry)->GetId());
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Chainstate stores and provides an API to update our local knowledge of the current best chain.
std::unordered_map< TxId, TxInfo, SaltedTxIdHasher > TxInfoMap
void removeEntry(indexed_disconnected_transactions::index< insertion_order >::type::iterator entry)
indexed_disconnected_transactions queuedTx
TxInfoMap txInfo
populated by importMempool(); the original tx entry times and feeDeltas
~DisconnectedBlockTransactions()
void removeForBlock(const std::vector< CTransactionRef > &vtx)
uint64_t cachedInnerUsage
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
size_t DynamicMemoryUsage() const
const TxInfo * getTxInfo(const CTransactionRef &tx) const
void addTransaction(const CTransactionRef &tx)
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 transac...
void addForBlock(const std::vector< CTransactionRef > &vtx, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
const indexed_disconnected_transactions & GetQueuedTx() const
void importMempool(CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
static size_t RecursiveDynamicUsage(const CScript &script)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
static size_t DynamicUsage(const int8_t &v)
Dynamic memory usage for built-in types is zero.
static size_t MallocUsage(size_t alloc)
Compute the total memory used by allocating alloc bytes.
std::shared_ptr< const CTransaction > CTransactionRef
TxInfo(const std::chrono::seconds &time_, Amount feeDelta_, unsigned height_) noexcept
const std::chrono::seconds time
DisconnectedBlockTransactions.
#define EXCLUSIVE_LOCKS_REQUIRED(...)