net: don’t self advertise tor exit node ip addresses in outbound connections #35578

Open
stratospher wants to merge 4 commits from 2026-05-self-adv-tor-exit into master AGit
stratospher commented 2026-06-21 18:37:45 +00:00 (Migrated from github.com)
  • During self advertisement in GetLocalAddrFromPeer - we advertise the "IP address we think we are" and sometimes replace it with what "IP address the peer thinks we are".
  • when an outbound connections is made to a peer via a proxy, the "IP address the peer thinks we are" is the proxy's ip address.
  • so the proxy's ip address can get relayed as our self advertisement
  • in normal cases the proxy's ip address is not a reachable inbound address and shouldn't be relayed on the network.

Example: when a node running both Tor and clearnet via a SOCKS5 proxy connects to a clearnet peer (proxy=127.0.0.1:9050, listen=1, discover=1 (or) onion=127.0.0.1:9050), the "IP address the peer thinks we are" is the Tor exit node's IP address and doesn't make sense to relay it. 55-76% of all tor exit nodes were present in various addrman snapshots I checked (my node and the ones from b10c’s peer.observer) from now and few years ago. would be nice to not unnecessarily relay these tor exit IPs since they end up being stored as fresh and gossiped from multiple sources entries in our addrman.

an advanced node runner might have a proxy whose ip address is also a reachable inbound address. I've personally not used such a proxy but 1 difference for them is that they'd need to explicitly set -externalip=<addr> to self-advertise their proxy address. i feel it’s an acceptable tradeoff and would imagine they are already using -externalip=<addr> config flag as they are explicitly managing their node's public address.

- During self advertisement in[ `GetLocalAddrFromPeer`](https://github.com/bitcoin/bitcoin/blob/ea626c268add060c207809c5b22c0e11f284f232/src/net.cpp#L241) - we advertise the "IP address we think we are" and sometimes replace it with what "IP address the peer thinks we are". - when an outbound connections is made to a peer via a proxy, the "IP address the peer thinks we are" is the proxy's ip address. - so the proxy's ip address can get relayed as our self advertisement - in normal cases the proxy's ip address is not a reachable inbound address and shouldn't be relayed on the network. Example: when a node running both Tor and clearnet via a SOCKS5 proxy connects to a clearnet peer (`proxy=127.0.0.1:9050, listen=1, discover=1` (or) `onion=127.0.0.1:9050`), the "IP address the peer thinks we are" is the Tor exit node's IP address and doesn't make sense to relay it. 55-76% of all tor exit nodes were present in various addrman snapshots I checked (my node and the ones from b10c’s peer.observer) from now and few years ago. would be nice to not unnecessarily relay these tor exit IPs since they end up being stored as fresh and gossiped from multiple sources entries in our addrman. an advanced node runner might have a proxy whose ip address is also a reachable inbound address. I've personally not used such a proxy but 1 difference for them is that they'd need to explicitly set `-externalip=<addr>` to self-advertise their proxy address. i feel it’s an acceptable tradeoff and would imagine they are already using` -externalip=<addr>` config flag as they are explicitly managing their node's public address.
DrahtBot commented 2026-06-21 18:37:52 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept ACK 0xB10C, naiyoma, mzumsande

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/35578 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/35578.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/35578#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | Concept ACK | [0xB10C](https://github.com/bitcoin/bitcoin/pull/35578#issuecomment-4807919033), [naiyoma](https://github.com/bitcoin/bitcoin/pull/35578#issuecomment-4938015789), [mzumsande](https://github.com/bitcoin/bitcoin/pull/35578#pullrequestreview-4789341836) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts No conflicts as of last run. <!--5faf32d7da4f0f540f40219e4f7537a3-->
0xB10C commented 2026-06-26 08:37:48 +00:00 (Migrated from github.com)

Concept ACK, it makes sense to me to not advertise an address we know we can't be reached on. I think this is the case when using -proxy, as we specifically say "make outbound connections through this SOCKS5" but don't expect inbound connections via this socket. There seems to be something called BIND-request for SOCKS5 proxies, but I don't think that's widely supported (and not implemented in Bitcoin Core).

I've looked at the number of connections my nodes make to Tor exit node IPs in this post: In mid 2026, my nodes each make between 7.5 to 12.5 connection attempts per day to Tor exit node IPs.

While nearly all of these connection attempts fail (as expected), there's about 20 IPs where I've seen some connections to Tor exit node IPs succeed over the last years. I assume these are hosts that run (or ran at some point) a Tor exit node and a Bitcoin node, which isn't too unexpected.

Concept ACK, it makes sense to me to not advertise an address we know we can't be reached on. I think this is the case when using `-proxy`, as we specifically say "make outbound connections through this SOCKS5" but don't expect inbound connections via this socket. There seems to be something called [`BIND`-request](https://www.rfc-editor.org/info/rfc1928/#section-6) for SOCKS5 proxies, but I don't think that's widely supported (and not implemented in Bitcoin Core). I've looked at the number of connections my nodes make to Tor exit node IPs in this [post](https://bnoc.xyz/t/outbound-connection-success-rates-of-a-bitcoin-node/142/10?u=b10c): In mid 2026, my nodes each make between 7.5 to 12.5 connection attempts per day to Tor exit node IPs. While nearly all of these connection attempts fail (as expected), there's about 20 IPs where I've seen some connections to Tor exit node IPs succeed over the last years. I assume these are hosts that run (or ran at some point) a Tor exit node and a Bitcoin node, which isn't too unexpected.
0xB10C commented 2026-06-26 09:12:42 +00:00 (Migrated from github.com)

proxy=127.0.0.1:9050, listen=1, discover=1

Hm are we sure this is being used like this? With just -proxy set, we wouldn't be listening and not self-announcing.

github.com/bitcoin/bitcoin@93012d7ff9/src/init.cpp (L812-L825)

github.com/bitcoin/bitcoin@93012d7ff9/src/net_processing.cpp (L5475-L5476)

> proxy=127.0.0.1:9050, listen=1, discover=1 Hm are we sure this is being used like this? With just `-proxy` set, we wouldn't be listening and not self-announcing. https://github.com/bitcoin/bitcoin/blob/93012d7ff918eef41adf453bf10ddb4da21f3df4/src/init.cpp#L812-L825 https://github.com/bitcoin/bitcoin/blob/93012d7ff918eef41adf453bf10ddb4da21f3df4/src/net_processing.cpp#L5475-L5476
stratospher commented 2026-06-30 09:21:10 +00:00 (Migrated from github.com)

proxy=127.0.0.1:9050, listen=1, discover=1

Hm are we sure this is being used like this? With just -proxy set, we wouldn't be listening and not self-announcing.

good point. it's either this or people using onion=127.0.0.1:9050.

even though there is the soft-set init parameter interactions which does proxy=127.0.0.1:9050 -> listen=0 and discover=0 - I wouldn't be surprised if people end up overriding it.

  • listen=1 is overriden to allow inbound connections without having to deal with the clearnet firewall rules. I've seen/done this a lot.
  • I think discover=1 and its interaction with other parameters can be confusing to users. It makes a node's own IP discoverable to peers (the node advertises it). That IP is obtained from the node's own machine, and (less obviously) also from what peers report the node's address to be.
    • If the node wants control over what exactly it advertises, -externalip=<ip> can be used (keeping the soft-set discover=0) - the node then advertises only the address we specified in externalip, and not the peer-reported view of a node's IP.
    • if -externalip=<ip> is used with explicit discover=1 override in the bitcoin.conf then again the peer-report view of a node's ip can be advertised.

quick GitHub search shows proxy=127.0.0.1:9050, listen=1, discover=1 use here and here. unsure if it's common/rare/how many people use it like this though.

> >proxy=127.0.0.1:9050, listen=1, discover=1 > Hm are we sure this is being used like this? With just -proxy set, we wouldn't be listening and not self-announcing. good point. it's either this or people using `onion=127.0.0.1:9050`. even though there is the soft-set init parameter interactions which does `proxy=127.0.0.1:9050` -> `listen=0` and `discover=0` - I wouldn't be surprised if people end up overriding it. - `listen=1` is overriden to allow inbound connections without having to deal with the clearnet firewall rules. I've seen/done this a lot. - I think `discover=1` and its interaction with other parameters can be confusing to users. It makes a node's own IP discoverable to peers (the node advertises it). That IP is obtained from the [node's own machine](https://github.com/bitcoin/bitcoin/blob/3c76bd435681ee2ebaa1f407ac23736d9c3b331b/src/net.cpp#L3422), and (less obviously) also from what peers [report the node's address](https://github.com/bitcoin/bitcoin/blob/3c76bd435681ee2ebaa1f407ac23736d9c3b331b/src/net_processing.cpp#L3701) to be. - If the node wants control over what exactly it advertises, `-externalip=<ip>` can be used (keeping the soft-set `discover=0`) - the node then advertises only the address we specified in `externalip`, and not the peer-reported view of a node's IP. - if `-externalip=<ip>` is used with explicit `discover=1` override in the bitcoin.conf then again the peer-report view of a node's ip can be advertised. quick GitHub search shows `proxy=127.0.0.1:9050, listen=1, discover=1` use [here](https://github.com/bitcoin/bitcoin/issues/24536#issue-1166639434) and [here](https://github.com/fajremvp/homelab/blob/main/configuration/orangeshadow/bitcoin/bitcoin.conf). unsure if it's common/rare/how many people use it like this though.
naiyoma commented 2026-07-10 17:46:58 +00:00 (Migrated from github.com)

Concept ACK
It makes sense not to advertise these addresses, as they are not useful.
i used this list https://check.torproject.org/torbulkexitlist to check for tor exit nodes.

On master, I noticed that sometimes clearnet outbound peers would send me their own addresses as my address, and I would occasionally self-advertise those same addresses back to them. I think this PR fixes that only for proxy, but maybe we should also add check so that a peer does not send us their own address.

tested 412aa3d1fd with listen=1 proxy=127.0.0.1:9050 discover=1

My logs show that even when the score flip favoured the peers reported address for an outbound clearnet (tor_proxied ) peer , we do not advertise it , instead we now always fallback to advertising our own adress that we know.

Logs
2026-07-10T13:12:40Z New outbound-full-relay peer connected: transport: v2, version: 70016, peer=4, peeraddr=91.67.73.147:8333
2026-07-10T13:12:40Z [net] sending sendcmpct (9 bytes) peer=4
2026-07-10T13:12:40Z [net] sending ping (8 bytes) peer=4
2026-07-10T13:12:40Z [net] Maybe we should self announce to this address relay peer 4, relay_enabled=1, fListen=1, next_local_addr_send=0, current_time=1783689160359904
...
2026-07-10T13:12:40Z [net] GetLocalAddrForPeer peer=4: ours=[2605:59c1:4782:7c08:4936:c6a5:fdee:50d2]:8333 (routable=1) peer_reported=185.220.101.24:43126 (routable=1) | peer_good=1 own_unroutable=0 own_score=1 LOCAL_MANUAL=4 flip_bits=1 (1-in-2) won_flip=1 -> using peer's addrLocal
2026-07-10T13:12:40Z [net] Advertising address [2605:xxx:xx:xxx:xx:xx:xx]:8333 to peer=4
Concept ACK It makes sense not to advertise these addresses, as they are not useful. i used this list https://check.torproject.org/torbulkexitlist to check for tor exit nodes. On master, I noticed that sometimes clearnet outbound peers would send me their own addresses as my address, and I would occasionally self-advertise those same addresses back to them. I think this PR fixes that only for proxy, but maybe we should also add check so that a peer does not send us their own address. tested 412aa3d1fde685bb6b0da7c34ae943383bd02189 with `listen=1 proxy=127.0.0.1:9050 discover=1 ` My logs show that even when the score flip favoured the peers reported address for an outbound clearnet (tor_proxied ) peer , we do not advertise it , instead we now always fallback to advertising our own adress that we know. <details> <summary>Logs</summary> ``` 2026-07-10T13:12:40Z New outbound-full-relay peer connected: transport: v2, version: 70016, peer=4, peeraddr=91.67.73.147:8333 2026-07-10T13:12:40Z [net] sending sendcmpct (9 bytes) peer=4 2026-07-10T13:12:40Z [net] sending ping (8 bytes) peer=4 2026-07-10T13:12:40Z [net] Maybe we should self announce to this address relay peer 4, relay_enabled=1, fListen=1, next_local_addr_send=0, current_time=1783689160359904 ... 2026-07-10T13:12:40Z [net] GetLocalAddrForPeer peer=4: ours=[2605:59c1:4782:7c08:4936:c6a5:fdee:50d2]:8333 (routable=1) peer_reported=185.220.101.24:43126 (routable=1) | peer_good=1 own_unroutable=0 own_score=1 LOCAL_MANUAL=4 flip_bits=1 (1-in-2) won_flip=1 -> using peer's addrLocal 2026-07-10T13:12:40Z [net] Advertising address [2605:xxx:xx:xxx:xx:xx:xx]:8333 to peer=4 ``` </details>
naiyoma (Migrated from github.com) reviewed 2026-07-10 17:48:11 +00:00
naiyoma (Migrated from github.com) commented 2026-07-10 17:48:11 +00:00

Maybe add a comment? to explain a bit on why there's a proxy check here

Maybe add a comment? to explain a bit on why there's a proxy check here
naiyoma (Migrated from github.com) reviewed 2026-07-16 11:28:22 +00:00
naiyoma (Migrated from github.com) commented 2026-07-16 11:28:22 +00:00

An alternative approach would be to check whether an outbound connection is proxied before we even check if IsPeerAddrLocalGood(), since the result isn't useful if we won't use the address anyway.


std::optional<CService> GetLocalAddrForPeer(CNode& node)
 {
     CService addrLocal{GetLocalAddress(node)};
+    // For outbound connections through a proxy, the address the peer reports
+    // seeing us as is the proxy's exit IP, not ours, so it must never be
+    // relayed as our self-advertised address. Skip the peer's view
+    // entirely in that case and keep what we know ourselves to be.
+    const bool outbound_via_proxy{!node.IsInboundConn() &&
+                                  GetProxy(node.addr.GetNetwork()).has_value()};
     // If discovery is enabled, sometimes give our peer the address it
     // tells us that it sees us as in case it has a better idea of our
     // address than we do.
     FastRandomContext rng;
-    if (IsPeerAddrLocalGood(&node) && (!addrLocal.IsRoutable() ||
+    if (!outbound_via_proxy && IsPeerAddrLocalGood(&node) && (!addrLocal.IsRoutable() ||
          rng.randbits((GetnScore(addrLocal) > LOCAL_MANUAL) ? 3 : 1) == 0))
     {
         if (node.IsInboundConn()) {
             // For inbound connections, assume both the address and the port
             // as seen from the peer.
             addrLocal = CService{node.GetAddrLocal()};
-        } else if (!GetProxy(node.addr.GetNetwork()).has_value()) {
+        } else {

An alternative approach would be to check whether an outbound connection is proxied before we even check if `IsPeerAddrLocalGood()`, since the result isn't useful if we won't use the address anyway. ```diff std::optional<CService> GetLocalAddrForPeer(CNode& node) { CService addrLocal{GetLocalAddress(node)}; + // For outbound connections through a proxy, the address the peer reports + // seeing us as is the proxy's exit IP, not ours, so it must never be + // relayed as our self-advertised address. Skip the peer's view + // entirely in that case and keep what we know ourselves to be. + const bool outbound_via_proxy{!node.IsInboundConn() && + GetProxy(node.addr.GetNetwork()).has_value()}; // If discovery is enabled, sometimes give our peer the address it // tells us that it sees us as in case it has a better idea of our // address than we do. FastRandomContext rng; - if (IsPeerAddrLocalGood(&node) && (!addrLocal.IsRoutable() || + if (!outbound_via_proxy && IsPeerAddrLocalGood(&node) && (!addrLocal.IsRoutable() || rng.randbits((GetnScore(addrLocal) > LOCAL_MANUAL) ? 3 : 1) == 0)) { if (node.IsInboundConn()) { // For inbound connections, assume both the address and the port // as seen from the peer. addrLocal = CService{node.GetAddrLocal()}; - } else if (!GetProxy(node.addr.GetNetwork()).has_value()) { + } else { ```
naiyoma (Migrated from github.com) reviewed 2026-07-16 13:17:56 +00:00
naiyoma (Migrated from github.com) commented 2026-07-16 13:17:56 +00:00

I think its possible to test this in net_tests.cpp similar to get_local_addr_for_peer_port
but using SetProxy() and verifying that we dont relay what the peer told us.

I tried this locally


+BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_proxy)
+{
+    // when proxy is set for an outbound connection, the address
+    // the peer sends us is the proxy's view of us, not our actual address
+    // we ignore this this and instead announce what we think we are
+    // With no local address know,nothing is advertised
+    // with a routable local address known, that is advertised
+
+    in_addr peer_us_addr;
+    peer_us_addr.s_addr = htonl(0x02030405);
+
+    const CService peer_us{peer_us_addr, 20002};
+    std::cout << "peer_us: " << peer_us.ToStringAddr() << std::endl;
+
+    in_addr peer_out_in_addr;
+    peer_out_in_addr.s_addr = htonl(0x01020304);
+
+    std::cout << "peer_out_in_addr: " << CService{peer_out_in_addr, 8333}.ToStringAddr() << std::endl;
+    CNode peer_out{/*id=*/0, /*sock=*/nullptr,
+                     /*addrIn=*/CAddress{CService{peer_out_in_addr, 8333}, NODE_NETWORK},
+                     /*nKeyedNetGroupIn=*/0,
+                     /*nLocalHostNonceIn=*/0,
+                     /*addrBindIn=*/CService{},
+                     /*addrNameIn=*/std::string{},
+                     /*conn_type_in=*/ConnectionType::OUTBOUND_FULL_RELAY,
+                     /*inbound_onion=*/false,
+                     /*network_key=*/0};
+
+    peer_out.fSuccessfullyConnected = true;
+    peer_out.SetAddrLocal(peer_us);
+
+    std::cout << "peer_out: " << peer_out.addr.ToStringAddr() << std::endl;
+    BOOST_REQUIRE(SetProxy(NET_IPV4, Proxy{CService{peer_out_in_addr, 9050}}));
+
+    BOOST_REQUIRE(!GetLocalAddrForPeer(peer_out));
+
+    const CService our_addr{Lookup("8.8.8.8", 8333, false).value()};
+    BOOST_REQUIRE(AddLocal(our_addr, LOCAL_MANUAL));
+
+    auto chosen = GetLocalAddrForPeer(peer_out);
+    std::cout << "our_addr: " << our_addr.ToStringAddr() << std::endl;
+    std::cout << "chosen: " << (chosen ? chosen->ToStringAddr() : "none") << std::endl;
+
+    BOOST_REQUIRE(chosen);
+    BOOST_CHECK(*chosen == our_addr);
+    ResetProxy(NET_IPV4);
+    RemoveLocal(our_addr);
+}

I think its possible to test this in `net_tests.cpp` similar to `get_local_addr_for_peer_port` but using `SetProxy()` and verifying that we dont relay what the peer told us. I tried this locally ``` diff +BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_proxy) +{ + // when proxy is set for an outbound connection, the address + // the peer sends us is the proxy's view of us, not our actual address + // we ignore this this and instead announce what we think we are + // With no local address know,nothing is advertised + // with a routable local address known, that is advertised + + in_addr peer_us_addr; + peer_us_addr.s_addr = htonl(0x02030405); + + const CService peer_us{peer_us_addr, 20002}; + std::cout << "peer_us: " << peer_us.ToStringAddr() << std::endl; + + in_addr peer_out_in_addr; + peer_out_in_addr.s_addr = htonl(0x01020304); + + std::cout << "peer_out_in_addr: " << CService{peer_out_in_addr, 8333}.ToStringAddr() << std::endl; + CNode peer_out{/*id=*/0, /*sock=*/nullptr, + /*addrIn=*/CAddress{CService{peer_out_in_addr, 8333}, NODE_NETWORK}, + /*nKeyedNetGroupIn=*/0, + /*nLocalHostNonceIn=*/0, + /*addrBindIn=*/CService{}, + /*addrNameIn=*/std::string{}, + /*conn_type_in=*/ConnectionType::OUTBOUND_FULL_RELAY, + /*inbound_onion=*/false, + /*network_key=*/0}; + + peer_out.fSuccessfullyConnected = true; + peer_out.SetAddrLocal(peer_us); + + std::cout << "peer_out: " << peer_out.addr.ToStringAddr() << std::endl; + BOOST_REQUIRE(SetProxy(NET_IPV4, Proxy{CService{peer_out_in_addr, 9050}})); + + BOOST_REQUIRE(!GetLocalAddrForPeer(peer_out)); + + const CService our_addr{Lookup("8.8.8.8", 8333, false).value()}; + BOOST_REQUIRE(AddLocal(our_addr, LOCAL_MANUAL)); + + auto chosen = GetLocalAddrForPeer(peer_out); + std::cout << "our_addr: " << our_addr.ToStringAddr() << std::endl; + std::cout << "chosen: " << (chosen ? chosen->ToStringAddr() : "none") << std::endl; + + BOOST_REQUIRE(chosen); + BOOST_CHECK(*chosen == our_addr); + ResetProxy(NET_IPV4); + RemoveLocal(our_addr); +}
mzumsande (Migrated from github.com) reviewed 2026-07-27 16:38:16 +00:00
mzumsande (Migrated from github.com) left a comment

Concept ACK

I wonder if it is really all explained by misconfigurations, overriding defaults, and if everyone would be running this branch, the exit nodes would stop being relayed.

Maybe it could also due to transparent torification where users do not change any defaults but the traffic is rerouted via tor externally, e.g. by an OS such as Whonix? In that case, the fix might not solve the problem completely.

Concept ACK I wonder if it is really all explained by misconfigurations, overriding defaults, and if everyone would be running this branch, the exit nodes would stop being relayed. Maybe it could also due to transparent torification where users do not change any defaults but the traffic is rerouted via tor externally, e.g. by an OS such as Whonix? In that case, the fix might not solve the problem completely.
sedited commented 2026-09-08 21:12:53 +00:00 (Migrated from github.com)

@stratospher what is the status here? There are a few unaddressed comments.

@stratospher what is the status here? There are a few unaddressed comments.
stratospher (Migrated from github.com) reviewed 2026-09-11 20:32:19 +00:00
stratospher (Migrated from github.com) commented 2026-09-11 20:32:19 +00:00

an advanced node runner might have a proxy whose ip address is also a reachable inbound address.

I don't think this use case would work with this patch. ex: tor exits who are also running bitcoin nodes.
I guess we should mention in the release notes that they now need to explicitly set externalip=<addr> .

> an advanced node runner might have a proxy whose ip address is also a reachable inbound address. I don't think this use case would work with this patch. ex: tor exits who are also running bitcoin nodes. I guess we should mention in the release notes that they now need to explicitly set `externalip=<addr>` .
stratospher commented 2026-09-11 20:37:26 +00:00 (Migrated from github.com)

@mzumsande good point! I don't think we have a way to know unless we see it in action in the P2P network and this patch obviously won't work for systems running transparent torrification. but we can try to reduce it from core's end when people override defaults.

even though it's not a problem currently, ~95% of the tor exit IPs don't have ports in p2p-bad-ports.md. some examples: 1031 tor exit IPs on port 443 (I vaguely remember some discussion on 443 being a good option for core as well), 705 tor exit IPs on port 9001, 276 tor exit IPs on port 9002.

if we ever switch to non default ports - it might get problematic for the tor exits. so I think it's still good to reduce unnecessary connection attempts to tor exits from our side (this is not an issue currently).

@mzumsande good point! I don't think we have a way to know unless we see it in action in the P2P network and this patch obviously won't work for systems running transparent torrification. but we can try to reduce it from core's end when people override defaults. even though it's not a problem currently, ~95% of the tor exit IPs don't have ports in `p2p-bad-ports.md`. some examples: 1031 tor exit IPs on port 443 (I vaguely remember some discussion on 443 being a good option for core as well), 705 tor exit IPs on port 9001, 276 tor exit IPs on port 9002. if we ever switch to non default ports - it might get problematic for the tor exits. so I think it's still good to reduce unnecessary connection attempts to tor exits from our side (this is not an issue currently).
stratospher (Migrated from github.com) reviewed 2026-09-14 22:00:33 +00:00
stratospher (Migrated from github.com) commented 2026-09-14 22:00:33 +00:00

done both in the latest push. thanks!

done both in the [latest push](https://github.com/bitcoin/bitcoin/compare/b5d58ee1496c554ceeb7e37d0a8256a696112fa0..d7e3ec6d0a4e34867b92bc7efc06b16c1df7f289). thanks!
stratospher commented 2026-09-15 01:22:17 +00:00 (Migrated from github.com)

CI failure is unrelated. could someone start the failed CI job again? thanks!
the latest push adds tests, a comment and a release note.

CI failure is unrelated. could someone start the failed CI job again? thanks! the [latest push](https://github.com/bitcoin/bitcoin/compare/b5d58ee1496c554ceeb7e37d0a8256a696112fa0..d7e3ec6d0a4e34867b92bc7efc06b16c1df7f289) adds tests, a comment and a release note.
First-time contributor

🔵 Suggestion · A fatal assertion can leave the IPv4 proxy set for later net_tests cases

A failed BOOST_REQUIRE after SetProxy would skip proxy cleanup and cause secondary failures in later advertisement tests.

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

🔵 Suggestion · Proxy coverage misses unrelated-network configurations

Although production checks the peer's network correctly, the test would also pass a predicate that suppresses peer-observed IPv4 addresses whenever any network has a proxy.

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

Review coverage was incomplete.


Reviewed: 3c6293a3f537 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:2b20819f882b885f79f242c01722f54f2a55e27dcfa7d5e13701b4a0b5214248:c39fdacfa3b84799844a5e841c04997e3cd1142653dfad8e36dbb07c4b1e684b --> <!-- ralph-base:e211dd0186e9646167d063a16f0da88e5f72e05f --> <!-- ralph-head:3c6293a3f53729c70ed59fd9da16f614510f8469 --> <!-- ralph-case:4701db81d95e17ebdf994bd33b3f289d89b5a3259d62bdb6e48c7c4c45532e2b --> **🔵 Suggestion · A fatal assertion can leave the IPv4 proxy set for later `net_tests` cases** A failed `BOOST_REQUIRE` after `SetProxy` would skip proxy cleanup and cause secondary failures in later advertisement tests. Location: [`src/test/net_tests.cpp:781`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/3c6293a3f53729c70ed59fd9da16f614510f8469/src/test/net_tests.cpp#L781>) (head). **🔵 Suggestion · Proxy coverage misses unrelated-network configurations** Although production checks the peer's network correctly, the test would also pass a predicate that suppresses peer-observed IPv4 addresses whenever any network has a proxy. Location: [`src/test/net_tests.cpp:759`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/3c6293a3f53729c70ed59fd9da16f614510f8469/src/test/net_tests.cpp#L759>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`3c6293a3f537`](<https://git.fish.foo/bitcoin/bitcoin/commit/3c6293a3f53729c70ed59fd9da16f614510f8469>) · [Review report](<https://review.fish.foo/report/35578-3c6293a3f53729c70ed59fd9da16f614510f8469-2768-4.html>) · [Previous reports](<https://review.fish.foo/traces/35578/>) [permalink](<https://review.fish.foo/report/35578-3c6293a3f53729c70ed59fd9da16f614510f8469-2768-4.html>)
DrahtBot commented 2026-10-20 08:43:20 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
stratospher commented 2026-10-20 20:29:56 +00:00 (Migrated from github.com)
looks like b403937 was done in https://github.com/bitcoin/bitcoin/pull/36177. I've removed it.
DrahtBot commented 2026-11-12 16:53:59 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!35578
No description provided.