Skip to content

Commit 1a9fa4c

Browse files
committed
Merge #20561: p2p: periodically clear m_addr_known
65273fa Clear m_addr_known before our periodic self-advertisement (Suhas Daftuar) Pull request description: We use a rolling bloom filter to track which addresses we've previously sent a peer, but after #7125 we no longer clear it every day before our own announcement. This looks to me like an oversight which has the effect of reducing the frequency with which we actually self-announce our own address, so this reintroduces resetting that filter. ACKs for top commit: naumenkogs: ACK 65273fa laanwj: Code review ACK 65273fa sipa: utACK 65273fa Tree-SHA512: 602c155fb6d2249b054fcb6f1c0dd17143605ceb87132286bbd90babf26d258ff6c41f9925482c17e2be41805d33f9b83926cb447f394969ffecd4bccfa0a64f
2 parents d38feb6 + 65273fa commit 1a9fa4c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/net_processing.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4074,6 +4074,15 @@ bool PeerManager::SendMessages(CNode* pto)
40744074
auto current_time = GetTime<std::chrono::microseconds>();
40754075

40764076
if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) {
4077+
// If we've sent before, clear the bloom filter for the peer, so that our
4078+
// self-announcement will actually go out.
4079+
// This might be unnecessary if the bloom filter has already rolled
4080+
// over since our last self-announcement, but there is only a small
4081+
// bandwidth cost that we can incur by doing this (which happens
4082+
// once a day on average).
4083+
if (pto->m_next_local_addr_send != std::chrono::microseconds::zero()) {
4084+
pto->m_addr_known->reset();
4085+
}
40774086
AdvertiseLocal(pto);
40784087
pto->m_next_local_addr_send = PoissonNextSend(current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
40794088
}

0 commit comments

Comments
 (0)