|
|
|
@ -13,7 +13,10 @@
|
|
|
|
|
/** Guards orphan transactions and extra txs for compact blocks */
|
|
|
|
|
extern RecursiveMutex g_cs_orphans;
|
|
|
|
|
|
|
|
|
|
/** Data structure to keep track of orphan transactions
|
|
|
|
|
/** A class to track orphan transactions (failed on TX_MISSING_INPUTS)
|
|
|
|
|
* Since we cannot distinguish orphans from bad transactions with
|
|
|
|
|
* non-existent inputs, we heavily limit the number of orphans
|
|
|
|
|
* we keep and the duration we keep them for.
|
|
|
|
|
*/
|
|
|
|
|
class TxOrphanage {
|
|
|
|
|
public:
|
|
|
|
@ -23,7 +26,9 @@ public:
|
|
|
|
|
/** Check if we already have an orphan transaction (by txid or wtxid) */
|
|
|
|
|
bool HaveTx(const GenTxid& gtxid) const EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
|
|
|
|
|
|
|
|
|
|
/** Get the details of an orphan transaction (returns nullptr if not found) */
|
|
|
|
|
/** Get an orphan transaction and its orginating peer
|
|
|
|
|
* (Transaction ref will be nullptr if not found)
|
|
|
|
|
*/
|
|
|
|
|
std::pair<CTransactionRef, NodeId> GetTx(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
|
|
|
|
|
|
|
|
|
|
/** Erase an orphan by txid */
|
|
|
|
@ -32,7 +37,7 @@ public:
|
|
|
|
|
/** Erase all orphans announced by a peer (eg, after that peer disconnects) */
|
|
|
|
|
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
|
|
|
|
|
|
|
|
|
|
/** Erase all orphans included in / invalidated by a new block */
|
|
|
|
|
/** Erase all orphans included in or invalidated by a new block */
|
|
|
|
|
void EraseForBlock(const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
|
|
|
|
|
|
|
|
|
|
/** Limit the orphanage to the given maximum */
|
|
|
|
|