2 suggestions
Optional improvements
[suggestion] · Outbound onion connections remain linkable through the cached nonce
Ordinary outbound onion peers sharing a local Tor proxy still receive the same cached tip nonce, preserving pre-existing linkage between those connections even though this PR separates networks.
Location: src/net_processing.cpp:2234 (head).
Details and suggested fix
ConnectNode derives the outbound m_network_key from the target network class and local socket address bytes, excluding both the destination identity and ephemeral local port. Onion connections through a local proxy such as 127.0.0.1 therefore share a key. When the available tip is cached and CanDirectFetch() holds, two attacker-run onion services that the node dials can each request getdata(MSG_CMPCT_BLOCK) and compare the identical cached nonce. Private-broadcast connections do not expose this route: they reject block requests and suppress CMPCTBLOCK output.
The documented key scope is protection across networks, and base already shared a nonce globally. If distinct outbound onion connections should also be unlinkable, give them a compact-block-only key with a per-connection component while retaining m_network_key for the other consumers and retaining grouped inbound caching. This adds per-connection construction and cache storage. If that isolation is outside scope, explicitly document that outbound onion peers on the same proxy continue to share a nonce.
[suggestion] · The new nonce test leaves the SendMessages lookup unchecked
A wrong network key confined to the changed SendMessages compact-block lookup would leave all new nonce assertions passing.
Location: src/net_processing.cpp:6257 (head).
Details and suggested fix
The high-bandwidth phase first synchronizes each peer to the current tip through request_cb_announcements, then generates successive blocks. NewPoWValidBlock fast-announces those blocks and sets pindexBestHeaderSent, so PeerHasHeader makes SendMessages skip them. The earlier GETDATA phase uses ProcessGetBlockData instead. Add a case that deliberately reaches the cached compact-block branch in SendMessages, then assert that its nonce matches the same-key group and differs from the other bind's nonce. A unit-level setup would suffice. The GETHEADERS handler also documents a state-reset route to reannouncement, but a deterministic functional sequence for that route has not been constructed.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The original timer design balanced two privacy constraints: independent timers per inbound connection let an attacker make multiple connections to estimate transaction arrival time, while one timer shared across every network exposed cross-network identity correlation. The proposed boundary was therefore shared state within network partitions, rather than universally independent state per connection.
This explains why the existing partition deliberately groups connections. However, the reason for sharing transaction-announcement timers is specific to timing attacks; it is not itself a documented reason to share compact-block nonces within those groups.
Unresolved disagreements
A comment on the introducing PR proposed giving every outbound onion connection a separate network_id as a follow-up, reasoning that those connections all look distinct to external observers. The inspected record does not resolve that proposal.
This is directly relevant to the intended isolation scope: the historical discussion recognized a potentially finer boundary for outbound onion connections than a shared network/bind key. It is not evidence of a dispute about compact-block nonces, which were not discussed in the inspected history.