From 65273fa0e74f0c11dfbf0645dd962bdc779ea558 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Thu, 3 Dec 2020 10:03:53 -0500 Subject: Clear m_addr_known before our periodic self-advertisement This behavior was apparently inadvertently broken in 5400ef6; without this change our daily self-announcements frequently go unsent, because our address is still in the peer's rolling bloom filter (for potentially many days, depending on addr traffic). --- src/net_processing.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ec5400c3d8..f4ebd11d56 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4074,6 +4074,15 @@ bool PeerManager::SendMessages(CNode* pto) auto current_time = GetTime(); if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) { + // If we've sent before, clear the bloom filter for the peer, so that our + // self-announcement will actually go out. + // This might be unnecessary if the bloom filter has already rolled + // over since our last self-announcement, but there is only a small + // bandwidth cost that we can incur by doing this (which happens + // once a day on average). + if (pto->m_next_local_addr_send != std::chrono::microseconds::zero()) { + pto->m_addr_known->reset(); + } AdvertiseLocal(pto); pto->m_next_local_addr_send = PoissonNextSend(current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL); } -- cgit v1.2.3