Skip to content

Commit b6c5d1e

Browse files
committed
p2p: AddrFetch - don't disconnect on self-announcements
Disconnecting an AddrFetch peer only after receiving an addr message of size >1 prevents dropping them before they had a chance to answer the getaddr request.
1 parent 7257e50 commit b6c5d1e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2779,7 +2779,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
27792779
}
27802780
m_addrman.Add(vAddrOk, pfrom.addr, 2 * 60 * 60);
27812781
if (vAddr.size() < 1000) peer->m_getaddr_sent = false;
2782-
if (pfrom.IsAddrFetchConn()) {
2782+
2783+
// AddrFetch: Require multiple addresses to avoid disconnecting on self-announcements
2784+
if (pfrom.IsAddrFetchConn() && vAddr.size() > 1) {
27832785
LogPrint(BCLog::NET, "addrfetch connection completed peer=%d; disconnecting\n", pfrom.GetId());
27842786
pfrom.fDisconnect = true;
27852787
}

0 commit comments

Comments
 (0)