aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorKristaps Kaupe <kristaps@blogiem.lv>2022-09-07 21:30:50 +0300
committerKristaps Kaupe <kristaps@blogiem.lv>2022-09-09 01:39:52 +0300
commitce4257026622287c8c981fb932681730a3c6387f (patch)
tree2aec64ee40c1b3c6c1d6affebea2803972abacc1 /src/net.cpp
parent37095c7dc4a85155c35e2473b6a20a53ae413cea (diff)
downloadbitcoin-ce4257026622287c8c981fb932681730a3c6387f.tar.xz
doc: comment "add only reachable addresses to addrman"
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index d1df393ad3..1fdb867a09 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1648,6 +1648,14 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
if (add_fixed_seeds_now) {
std::vector<CAddress> seed_addrs{ConvertSeeds(Params().FixedSeeds())};
+ // We will not make outgoing connections to peers that are unreachable
+ // (e.g. because of -onlynet configuration).
+ // Therefore, we do not add them to addrman in the first place.
+ // Note that if you change -onlynet setting from one network to another,
+ // peers.dat will contain only peers of unreachable networks and
+ // manual intervention will be needed (either delete peers.dat after
+ // configuration change or manually add some reachable peer using addnode),
+ // see <https://github.com/bitcoin/bitcoin/issues/26035> for details.
seed_addrs.erase(std::remove_if(seed_addrs.begin(), seed_addrs.end(),
[](const CAddress& addr) { return !IsReachable(addr); }),
seed_addrs.end());