aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2020-12-03 10:03:53 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2020-12-03 13:10:37 -0500
commit65273fa0e74f0c11dfbf0645dd962bdc779ea558 (patch)
treeb7a48da197cc3e46690e68431571263fc2ae6384 /src/net_processing.cpp
parenta0489f3472f3799dc1ece32a59556fd239c4c14b (diff)
downloadbitcoin-65273fa0e74f0c11dfbf0645dd962bdc779ea558.tar.xz
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).
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp9
1 files changed, 9 insertions, 0 deletions
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<std::chrono::microseconds>();
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);
}