Skip to content

Commit 5e50e2d

Browse files
committed
txorphanage: comment improvements
1 parent eeeafb3 commit 5e50e2d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/txorphanage.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
/** Guards orphan transactions and extra txs for compact blocks */
1414
extern RecursiveMutex g_cs_orphans;
1515

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.
1720
*/
1821
class TxOrphanage {
1922
public:
@@ -23,7 +26,9 @@ class TxOrphanage {
2326
/** Check if we already have an orphan transaction (by txid or wtxid) */
2427
bool HaveTx(const GenTxid& gtxid) const EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
2528

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+
*/
2732
std::pair<CTransactionRef, NodeId> GetTx(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
2833

2934
/** Erase an orphan by txid */
@@ -32,7 +37,7 @@ class TxOrphanage {
3237
/** Erase all orphans announced by a peer (eg, after that peer disconnects) */
3338
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
3439

35-
/** Erase all orphans included in / invalidated by a new block */
40+
/** Erase all orphans included in or invalidated by a new block */
3641
void EraseForBlock(const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
3742

3843
/** Limit the orphanage to the given maximum */

0 commit comments

Comments
 (0)