aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-07-09 07:52:48 +0100
committerJohn Newbery <john@johnnewbery.com>2021-02-18 09:43:13 +0000
commit3e68efa615968e0c9d68a7f197c7852478f6be78 (patch)
tree301599bfff85fb0e1a83b2d5dfccc46180e894cd /src/net_processing.cpp
parentd21d2b264cd77c027a06f68289cf4c3f177d1ed0 (diff)
downloadbitcoin-3e68efa615968e0c9d68a7f197c7852478f6be78.tar.xz
[net] Move checks from GetLocalAddrForPeer to caller
GetLocalAddrForPeer() is only called in one place. The checks inside that function make more sense to be carried out be the caller: - fSuccessfullyConnected is already checked at the top of SendMessages(), so must be true when we call GetLocalAddrForPeer() - fListen can go into the conditional before GetLocalAddrForPeer() is called.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 60b2975b67..428a45e73b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -4416,7 +4416,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
// Address refresh broadcast
auto current_time = GetTime<std::chrono::microseconds>();
- if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) {
+ if (fListen && 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