diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2021-05-28 16:06:27 +0200 |
---|---|---|
committer | Martin Zumsande <mzumsande@gmail.com> | 2021-05-28 18:29:05 +0200 |
commit | b6c5d1e450dde6a54bd785504c923adfb45c7060 (patch) | |
tree | 9c2557716897e30701e0df891267611650b540be /src/net_processing.cpp | |
parent | 7257e50dba36328be60f69c998632408802b9a29 (diff) |
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.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 0b83f756b3..51d628773c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2779,7 +2779,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, } m_addrman.Add(vAddrOk, pfrom.addr, 2 * 60 * 60); if (vAddr.size() < 1000) peer->m_getaddr_sent = false; - if (pfrom.IsAddrFetchConn()) { + + // AddrFetch: Require multiple addresses to avoid disconnecting on self-announcements + if (pfrom.IsAddrFetchConn() && vAddr.size() > 1) { LogPrint(BCLog::NET, "addrfetch connection completed peer=%d; disconnecting\n", pfrom.GetId()); pfrom.fDisconnect = true; } |