13
13
/* * Guards orphan transactions and extra txs for compact blocks */
14
14
extern RecursiveMutex g_cs_orphans;
15
15
16
- /* * Data structure to keep track of orphan transactions
16
+ /* * A class to track orphan transactions (failed on TX_MISSING_INPUTS)
17
+ * Since we cannot distinguish orphans from bad transactions with
18
+ * non-existent inputs, we heavily limit the number of orphans
19
+ * we keep and the duration we keep them for.
17
20
*/
18
21
class TxOrphanage {
19
22
public:
@@ -23,7 +26,9 @@ class TxOrphanage {
23
26
/* * Check if we already have an orphan transaction (by txid or wtxid) */
24
27
bool HaveTx (const GenTxid& gtxid) const EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
25
28
26
- /* * Get the details of an orphan transaction (returns nullptr if not found) */
29
+ /* * Get an orphan transaction and its orginating peer
30
+ * (Transaction ref will be nullptr if not found)
31
+ */
27
32
std::pair<CTransactionRef, NodeId> GetTx (const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
28
33
29
34
/* * Erase an orphan by txid */
@@ -32,7 +37,7 @@ class TxOrphanage {
32
37
/* * Erase all orphans announced by a peer (eg, after that peer disconnects) */
33
38
void EraseForPeer (NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
34
39
35
- /* * Erase all orphans included in / invalidated by a new block */
40
+ /* * Erase all orphans included in or invalidated by a new block */
36
41
void EraseForBlock (const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
37
42
38
43
/* * Limit the orphanage to the given maximum */
0 commit comments