test: also reset CConnman::m_private_broadcast in tests
What changed, and why it matters
This is a Bitcoin Core test-only fix. It resets a small piece of connection-manager state between repeated fuzz-test runs so that earlier iterations do not influence later ones. It does not change production network code and is not an exploitable security bug in live Bitcoin software.
No production action needed. Ensure fuzz-test harnesses pick up this reset behavior and monitor for similar state-carry-over issues in other test-only Connman members.
Security signals we found
Non-determinism in fuzz testing infrastructure
State not reset between repeated test iterations
Test-only access-control change (private -> protected + friend struct)
Evidence from the diff
The commit changes CConnman::m_private_broadcast visibility from private to protected and adds a friend declaration for ConnmanTestMsg so that the test helper ConnmanTestMsg::Reset() can reset m_private_broadcast.m_outbound_tor_ok_at_least_once and m_private_broadcast.m_num_to_open. The goal is to remove non-determinism in fuzz tests process_message and process_messages when a single CConnman instance is reused across iterations. The change is confined to test infrastructure and net.h access control; no production logic is altered.
Changed components
src/net.h CConnman::m_private_broadcastsrc/test/util/net.cpp ConnmanTestMsg::Reset()fuzz tests process_message and process_messagesInspect captured patch +5 / −1
diff --git a/src/net.h b/src/net.h
index 1e4e9124..523b596f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -1241,7 +1241,7 @@ public:
/// Wait for the number of needed connections to become greater than 0.
void NumToOpenWait() const;
- private:
+ protected:
/**
* Check if private broadcast can be done to IPv4 or IPv6 peers and if so via which proxy.
* If private broadcast connections should not be opened to IPv4 or IPv6, then this will
@@ -1251,6 +1251,8 @@ public:
/// Number of `ConnectionType::PRIVATE_BROADCAST` connections to open.
std::atomic_size_t m_num_to_open{0};
+
+ friend struct ConnmanTestMsg;
} m_private_broadcast;
bool CheckIncomingNonce(uint64_t nonce);
diff --git a/src/test/util/net.cpp b/src/test/util/net.cpp
index 160ef979..a1c588b6 100644
--- a/src/test/util/net.cpp
+++ b/src/test/util/net.cpp
@@ -84,6 +84,8 @@ void ConnmanTestMsg::Reset()
{
ResetAddrCache();
ResetMaxOutboundCycle();
+ m_private_broadcast.m_outbound_tor_ok_at_least_once.store(false);
+ m_private_broadcast.m_num_to_open.store(0);
}
void ConnmanTestMsg::NodeReceiveMsgBytes(CNode& node, std::span<const uint8_t> msg_bytes, bool& complete) const
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.