aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-09-09 17:23:34 +0200
committerMacroFake <falke.marco@gmail.com>2022-09-09 17:23:41 +0200
commitef5bb742f0f57d144db480ad04304ab64474ee1a (patch)
tree8ee80c50b20332911f635a28552aef49b32a15ee
parent3c5fb9691b7b49042160cb161daa07ab2827c064 (diff)
parentce4257026622287c8c981fb932681730a3c6387f (diff)
Merge bitcoin/bitcoin#26040: doc: comment "add only reachable addresses to addrman"
ce4257026622287c8c981fb932681730a3c6387f doc: comment "add only reachable addresses to addrman" (Kristaps Kaupe) Pull request description: Proposed by Sjors during review of #25678, was likely just missed, as it also for me looks a code where comment will not hurt. https://github.com/bitcoin/bitcoin/pull/25678#discussion_r964482832 ACKs for top commit: mzumsande: ACK ce4257026622287c8c981fb932681730a3c6387f vasild: ACK ce4257026622287c8c981fb932681730a3c6387f Zero-1729: re-ACK ce4257026622287c8c981fb932681730a3c6387f Tree-SHA512: ef085d527349de07c1b43ed39e55e34b29cb0137c9509bd14a1af88206f7d4aa7dfec1dca53a9deaed67a2d0f32fa21e0b1a04d4d5d7f8a265dfab3b62bf8c54
-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());