Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
TxOrphanageTest Class Reference
Inheritance diagram for TxOrphanageTest:
[legend]
Collaboration diagram for TxOrphanageTest:
[legend]

Public Member Functions

 TxOrphanageTest (FastRandomContext &rng)
 
size_t CountOrphans () const
 
CTransactionRef RandomOrphan ()
 
- Public Member Functions inherited from TxOrphanage
bool AddTx (const CTransactionRef &tx, NodeId peer)
 Add a new orphan transaction. More...
 
bool HaveTx (const Wtxid &wtxid) const
 Check if we already have an orphan transaction (by wtxid only) More...
 
CTransactionRef GetTxToReconsider (NodeId peer)
 Extract a transaction from a peer's work set Returns nullptr if there are no transactions to work on. More...
 
int EraseTx (const Wtxid &wtxid)
 Erase an orphan by wtxid. More...
 
void EraseForPeer (NodeId peer)
 Erase all orphans announced by a peer (eg, after that peer disconnects) More...
 
void EraseForBlock (const CBlock &block)
 Erase all orphans included in or invalidated by a new block. More...
 
void LimitOrphans (unsigned int max_orphans, FastRandomContext &rng)
 Limit the orphanage to the given maximum. More...
 
void AddChildrenToWorkSet (const CTransaction &tx)
 Add any orphans that list a particular tx as a parent into the from peer's work set. More...
 
bool HaveTxToReconsider (NodeId peer)
 Does this peer have any work to do? More...
 
std::vector< CTransactionRefGetChildrenFromSamePeer (const CTransactionRef &parent, NodeId nodeid) const
 Get all children that spend from this tx and were received from nodeid. More...
 
std::vector< std::pair< CTransactionRef, NodeId > > GetChildrenFromDifferentPeer (const CTransactionRef &parent, NodeId nodeid) const
 Get all children that spend from this tx but were not received from nodeid. More...
 
size_t Size () const
 Return how many entries exist in the orphange. More...
 
std::vector< OrphanTxBaseGetOrphanTransactions () const
 

Public Attributes

FastRandomContextm_rng
 

Additional Inherited Members

- Protected Types inherited from TxOrphanage
using OrphanMap = decltype(m_orphans)
 
- Protected Attributes inherited from TxOrphanage
std::map< Wtxid, OrphanTxm_orphans
 Map from wtxid to orphan transaction record. More...
 
std::map< NodeId, std::set< Wtxid > > m_peer_work_set
 Which peer provided the orphans that need to be reconsidered. More...
 
std::map< COutPoint, std::set< OrphanMap::iterator, IteratorComparator > > m_outpoint_to_orphan_it
 Index from the parents' COutPoint into the m_orphans. More...
 
std::vector< OrphanMap::iterator > m_orphan_list
 Orphan transactions in vector for quick random eviction. More...
 
NodeSeconds m_next_sweep {0s}
 Timestamp for the next scheduled sweep of expired orphans. More...
 

Detailed Description

Definition at line 24 of file orphanage_tests.cpp.

Constructor & Destructor Documentation

◆ TxOrphanageTest()

TxOrphanageTest::TxOrphanageTest ( FastRandomContext rng)
inline

Definition at line 27 of file orphanage_tests.cpp.

Member Function Documentation

◆ CountOrphans()

size_t TxOrphanageTest::CountOrphans ( ) const
inline

Definition at line 29 of file orphanage_tests.cpp.

◆ RandomOrphan()

CTransactionRef TxOrphanageTest::RandomOrphan ( )
inline

Definition at line 34 of file orphanage_tests.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_rng

FastRandomContext& TxOrphanageTest::m_rng

Definition at line 43 of file orphanage_tests.cpp.


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