mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
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).
This commit is contained in:
parent
a0489f3472
commit
65273fa0e7
1 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue