net: ignore privacy network peer's view of our address

bitcoin/bitcoin: PR #36757

1 suggestion

Optional improvements

Link

[suggestion] · Privacy-peer tests miss preservation of our own privacy address

With no local privacy address, the new tests would also accept an implementation that suppresses all self-advertisement to privacy peers.

Location: src/test/net_tests.cpp:742 (head).

Details and suggested fix

The fixture calls ClearLocal(), and this test only sets -bind; it never adds a local onion or I2P service. Both new cases therefore expect nullopt. An early return for privacy peers in GetLocalAddrForPeer() would satisfy them, even though the intended behavior is to preserve our same-network privacy address and ignore only the peer-view override. The positive assertions in advertise_local_address call GetLocalAddress(), so they would not catch that wrapper regression. Keep these negative cases and add a positive outbound onion case: register a local onion service with AddLocal(onion_service, LOCAL_MANUAL), require GetLocalAddrForPeer(peer_out_onion) to return exactly that service despite its clearnet peer_us claim, then remove the local service.


Coverage details