Skip to content

Commit 42a0cf0

Browse files
MarcoFalkeknst
authored andcommitted
Merge bitcoin#21562: [net processing] Various tidying up of PeerManagerImpl ctor
fde1bf4 [net processing] Default initialize m_recent_confirmed_transactions (John Newbery) 37dcd12 scripted-diff: Rename recentRejects (John Newbery) cd9902a [net processing] Default initialize recentRejects (John Newbery) a28bfd1 [net processing] Default initialize m_stale_tip_check_time (John Newbery) 9190b01 [net processing] Add Orphanage empty consistency check (John Newbery) Pull request description: - Use default initialization of PeerManagerImpl members where possible - Remove unique_ptr indirection where it's not needed ACKs for top commit: MarcoFalke: ACK fde1bf4 👞 theStack: re-ACK fde1bf4 Tree-SHA512: 7ddedcc972df8e933e1fbe5c88b8ea17df89e1e58fc769518512c5540e49dc8eddb3f47e78d1329a6fc5644d2c1d11c981f681fd633f5218bfa4b3e6a86f3d7b
1 parent e3c69da commit 42a0cf0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ class PeerManagerImpl final : public PeerManager
872872
* million to make it highly unlikely for users to have issues with this
873873
* filter.
874874
*
875-
* Memory used: 1.3MB
875+
* Memory used: 1.3 MB
876876
*/
877877
CRollingBloomFilter m_recent_rejects GUARDED_BY(::cs_main){120'000, 0.000'001};
878878
uint256 hashRecentRejectsChainTip GUARDED_BY(cs_main);
@@ -1620,6 +1620,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node) {
16201620
assert(m_num_preferred_download_peers == 0);
16211621
assert(m_peers_downloading_from == 0);
16221622
assert(m_outbound_peers_with_protect_from_disconnect == 0);
1623+
assert(m_orphanage.Size() == 0);
16231624
}
16241625
} // cs_main
16251626

src/txorphanage.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ class TxOrphanage {
5050
* (ie orphans that may have found their final missing parent, and so should be reconsidered for the mempool) */
5151
void AddChildrenToWorkSet(const CTransaction& tx, std::set<uint256>& orphan_work_set) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
5252

53+
/** Return how many entries exist in the orphange */
54+
size_t Size() LOCKS_EXCLUDED(::g_cs_orphans)
55+
{
56+
LOCK(::g_cs_orphans);
57+
return m_orphans.size();
58+
}
59+
5360
protected:
5461
struct OrphanTx {
5562
CTransactionRef tx;

test/functional/p2p_permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def in_mempool():
133133
tx.vout[0].nValue += 1
134134
txid = tx.rehash()
135135
# Send the transaction twice. The first time, it'll be rejected by ATMP because it conflicts
136-
# with a mempool transaction. The second time, it'll be in the recentRejects filter.
136+
# with a mempool transaction. The second time, it'll be in the m_recent_rejects filter.
137137
p2p_rebroadcast_wallet.send_txs_and_test(
138138
[tx],
139139
self.nodes[1],

0 commit comments

Comments
 (0)