2222class TxOrphanage {
2323public:
2424 /* * Add a new orphan transaction */
25- bool AddTx (const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
25+ bool AddTx (const CTransactionRef& tx, NodeId peer);
2626
2727 /* * Check if we already have an orphan transaction (by wtxid only) */
28- bool HaveTx (const Wtxid& wtxid) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
28+ bool HaveTx (const Wtxid& wtxid) const ;
2929
3030 /* * Extract a transaction from a peer's work set
3131 * Returns nullptr if there are no transactions to work on.
3232 * Otherwise returns the transaction reference, and removes
3333 * it from the work set.
3434 */
35- CTransactionRef GetTxToReconsider (NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
35+ CTransactionRef GetTxToReconsider (NodeId peer);
3636
3737 /* * Erase an orphan by wtxid */
38- int EraseTx (const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
38+ int EraseTx (const Wtxid& wtxid);
3939
4040 /* * Erase all orphans announced by a peer (eg, after that peer disconnects) */
41- void EraseForPeer (NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
41+ void EraseForPeer (NodeId peer);
4242
4343 /* * Erase all orphans included in or invalidated by a new block */
44- void EraseForBlock (const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
44+ void EraseForBlock (const CBlock& block);
4545
4646 /* * Limit the orphanage to the given maximum */
47- void LimitOrphans (unsigned int max_orphans, FastRandomContext& rng) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
47+ void LimitOrphans (unsigned int max_orphans, FastRandomContext& rng);
4848
4949 /* * Add any orphans that list a particular tx as a parent into the from peer's work set */
50- void AddChildrenToWorkSet (const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex); ;
50+ void AddChildrenToWorkSet (const CTransaction& tx);
5151
5252 /* * Does this peer have any work to do? */
53- bool HaveTxToReconsider (NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex); ;
53+ bool HaveTxToReconsider (NodeId peer);
5454
5555 /* * Get all children that spend from this tx and were received from nodeid. Sorted from most
5656 * recent to least recent. */
57- std::vector<CTransactionRef> GetChildrenFromSamePeer (const CTransactionRef& parent, NodeId nodeid) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
57+ std::vector<CTransactionRef> GetChildrenFromSamePeer (const CTransactionRef& parent, NodeId nodeid) const ;
5858
5959 /* * Get all children that spend from this tx but were not received from nodeid. Also return
6060 * which peer provided each tx. */
61- std::vector<std::pair<CTransactionRef, NodeId>> GetChildrenFromDifferentPeer (const CTransactionRef& parent, NodeId nodeid) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex) ;
61+ std::vector<std::pair<CTransactionRef, NodeId>> GetChildrenFromDifferentPeer (const CTransactionRef& parent, NodeId nodeid) const ;
6262
6363 /* * Return how many entries exist in the orphange */
64- size_t Size () EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
64+ size_t Size ()
6565 {
66- LOCK (m_mutex);
6766 return m_orphans.size ();
6867 }
6968
7069protected:
71- /* * Guards orphan transactions */
72- mutable Mutex m_mutex;
73-
7470 struct OrphanTx {
7571 CTransactionRef tx;
7672 NodeId fromPeer;
@@ -80,10 +76,10 @@ class TxOrphanage {
8076
8177 /* * Map from wtxid to orphan transaction record. Limited by
8278 * -maxorphantx/DEFAULT_MAX_ORPHAN_TRANSACTIONS */
83- std::map<Wtxid, OrphanTx> m_orphans GUARDED_BY (m_mutex) ;
79+ std::map<Wtxid, OrphanTx> m_orphans;
8480
8581 /* * Which peer provided the orphans that need to be reconsidered */
86- std::map<NodeId, std::set<Wtxid>> m_peer_work_set GUARDED_BY (m_mutex) ;
82+ std::map<NodeId, std::set<Wtxid>> m_peer_work_set;
8783
8884 using OrphanMap = decltype (m_orphans);
8985
@@ -98,16 +94,16 @@ class TxOrphanage {
9894
9995 /* * Index from the parents' COutPoint into the m_orphans. Used
10096 * to remove orphan transactions from the m_orphans */
101- std::map<COutPoint, std::set<OrphanMap::iterator, IteratorComparator>> m_outpoint_to_orphan_it GUARDED_BY (m_mutex) ;
97+ std::map<COutPoint, std::set<OrphanMap::iterator, IteratorComparator>> m_outpoint_to_orphan_it;
10298
10399 /* * Orphan transactions in vector for quick random eviction */
104- std::vector<OrphanMap::iterator> m_orphan_list GUARDED_BY (m_mutex) ;
100+ std::vector<OrphanMap::iterator> m_orphan_list;
105101
106102 /* * Erase an orphan by wtxid */
107- int EraseTxNoLock (const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex) ;
103+ int EraseTxNoLock (const Wtxid& wtxid);
108104
109105 /* * Timestamp for the next scheduled sweep of expired orphans */
110- NodeSeconds m_next_sweep GUARDED_BY (m_mutex) {0s};
106+ NodeSeconds m_next_sweep{0s};
111107};
112108
113109#endif // BITCOIN_TXORPHANAGE_H
0 commit comments