aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-05-24 20:41:11 +0800
committerfanquake <fanquake@gmail.com>2021-05-24 20:42:08 +0800
commit296841794864992e908dbda36d2ca9d86c037a11 (patch)
tree2257179f0d55d0cb75c36c48481143707b591ee7
parentd3fa42c795b6fee3167b03c88cbf311fed8d3c71 (diff)
parentfe3d17df04decc4e856121eb311636977d60f80f (diff)
downloadbitcoin-296841794864992e908dbda36d2ca9d86c037a11.tar.xz
Merge bitcoin/bitcoin#22013: net: ignore block-relay-only peers when skipping DNS seed
fe3d17df04decc4e856121eb311636977d60f80f net: ignore block-relay-only peers when skipping DNS seed (Anthony Towns) Pull request description: Since #17428 bitcoind will attempt to reconnect to two block-relay-only anchors before doing any other outbound connections. When determining whether to use DNS seeds, it will currently see these two peers and decide "we're connected to the p2p network, so no need to lookup DNS" -- but block-relay-only peers don't do address relay, so if your address book is full of invalid addresses (apart from your anchors) this behaviour will prevent you from recovering from that situation. This patch changes it so that it only skips use of DNS seeds when there are two full-outbound peers, not just block-relay-only peers. ACKs for top commit: Sjors: utACK fe3d17d amitiuttarwar: ACK fe3d17df04decc4e856121eb311636977d60f80f, this impacts the very common case where we stop/start a node, persisting anchors & have a non-empty addrman (although, to be clear, wouldn't be particularly problematic in the common cases where the addrman has valid addresses) mzumsande: ACK fe3d17df04decc4e856121eb311636977d60f80f jonatack: ACK fe3d17df04decc4e856121eb311636977d60f80f prayank23: tACK https://github.com/bitcoin/bitcoin/pull/22013/commits/fe3d17df04decc4e856121eb311636977d60f80f Tree-SHA512: 9814b0d84321d7f45b5013eb40c420a0dd93bf9430f5ef12dce50d1912a18d5de2070d890a8c6fe737a3329b31059b823bc660b432d5ba21f02881dc1d951e94
-rw-r--r--src/net.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index cf7de7e1ab..1b6f04dead 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1638,7 +1638,7 @@ void CConnman::ThreadDNSAddressSeed()
{
LOCK(cs_vNodes);
for (const CNode* pnode : vNodes) {
- if (pnode->fSuccessfullyConnected && pnode->IsOutboundOrBlockRelayConn()) ++nRelevant;
+ if (pnode->fSuccessfullyConnected && pnode->IsFullOutboundConn()) ++nRelevant;
}
}
if (nRelevant >= 2) {