The Peer struct in net_processing.cpp has ~40 fields protected by 6 different mutexes, mixing address relay, headers sync, block announcements, ping/pong, transaction relay, and misbehavior state into one flat struct.
This makes it hard to see which fields belong together and which mutex protects what.
This PR groups related fields into four sub-structs, each owning its mutex where applicable:
| Sub-struct | Fields | Mutex |
|---|---|---|
PeerAddrRelay |
12 | m_addr_send_times_mutex |
PeerHeadersSyncState |
7 | m_headers_sync_mutex |
PeerBlockAnnouncement |
3 | m_block_inv_mutex |
PeerLatency |
3 | (all atomic) |
Access changes from flat (peer.m_addrs_to_send) to qualified (peer.m_addr_relay.m_addrs_to_send). No locking semantics, runtime behavior, or public interfaces change.
The first commit defines the four structs and adds them as members of Peer. The remaining four commits each move one group of fields and update all call sites.