mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 22:42:04 +01:00
[net processing] Add doxygen comments for orphan data and function
This commit is contained in:
parent
147d50d63e
commit
6e8dd99ef1
1 changed files with 26 additions and 3 deletions
|
@ -153,8 +153,14 @@ struct COrphanTx {
|
|||
int64_t nTimeExpire;
|
||||
size_t list_pos;
|
||||
};
|
||||
|
||||
/** Guards orphan transactions and extra txs for compact blocks */
|
||||
RecursiveMutex g_cs_orphans;
|
||||
/** Map from txid to orphan transaction record. Limited by
|
||||
* -maxorphantx/DEFAULT_MAX_ORPHAN_TRANSACTIONS */
|
||||
std::map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(g_cs_orphans);
|
||||
/** Index from wtxid into the mapOrphanTransactions to lookup orphan
|
||||
* transactions using their witness ids. */
|
||||
std::map<uint256, std::map<uint256, COrphanTx>::iterator> g_orphans_by_wtxid GUARDED_BY(g_cs_orphans);
|
||||
|
||||
void EraseOrphansFor(NodeId peer);
|
||||
|
@ -258,12 +264,19 @@ namespace {
|
|||
return &(*a) < &(*b);
|
||||
}
|
||||
};
|
||||
|
||||
/** Index from the parents' COutPoint into the mapOrphanTransactions. Used
|
||||
* to remove orphan transactions from the mapOrphanTransactions */
|
||||
std::map<COutPoint, std::set<std::map<uint256, COrphanTx>::iterator, IteratorComparator>> mapOrphanTransactionsByPrev GUARDED_BY(g_cs_orphans);
|
||||
/** Orphan transactions in vector for quick random eviction */
|
||||
std::vector<std::map<uint256, COrphanTx>::iterator> g_orphan_list GUARDED_BY(g_cs_orphans);
|
||||
|
||||
std::vector<std::map<uint256, COrphanTx>::iterator> g_orphan_list GUARDED_BY(g_cs_orphans); //! For random eviction
|
||||
|
||||
static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
|
||||
/** Orphan/conflicted/etc transactions that are kept for compact block reconstruction.
|
||||
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of
|
||||
* these are kept in a ring buffer */
|
||||
static std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans);
|
||||
/** Offset into vExtraTxnForCompact to insert the next tx */
|
||||
static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
|
||||
} // namespace
|
||||
|
||||
namespace {
|
||||
|
@ -2021,6 +2034,16 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHe
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconsider orphan transactions after a parent has been accepted to the mempool.
|
||||
*
|
||||
* @param[in/out] orphan_work_set The set of orphan transactions to reconsider. Generally only one
|
||||
* orphan will be reconsidered on each call of this function. This set
|
||||
* may be added to if accepting an orphan causes its children to be
|
||||
* reconsidered.
|
||||
* @param[out] removed_txn Transactions that were removed from the mempool as a result of an
|
||||
* orphan transaction being added.
|
||||
*/
|
||||
void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<CTransactionRef>& removed_txn)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
|
|
Loading…
Add table
Reference in a new issue