diff options
author | John Newbery <john@johnnewbery.com> | 2020-07-09 07:42:11 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-02-18 09:28:06 +0000 |
commit | d21d2b264cd77c027a06f68289cf4c3f177d1ed0 (patch) | |
tree | 8af47d2c169f527e619efae3c9c979874e3a486e /src/net_processing.cpp | |
parent | 9bbf08bf98487eeb75f143c120cfd544ea3135fb (diff) |
[net] Change AdvertiseLocal to GetLocalAddrForPeer
Gossiping addresses to peers is the responsibility of net processing.
Change AdvertiseLocal() in net to just return an (optional) address
for net processing to advertise. Update function name to reflect
new responsibility.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 881f5d7297..60b2975b67 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4426,7 +4426,10 @@ bool PeerManagerImpl::SendMessages(CNode* pto) if (pto->m_next_local_addr_send != 0us) { pto->m_addr_known->reset(); } - AdvertiseLocal(pto); + if (Optional<CAddress> local_addr = GetLocalAddrForPeer(pto)) { + FastRandomContext insecure_rand; + pto->PushAddress(*local_addr, insecure_rand); + } pto->m_next_local_addr_send = PoissonNextSend(current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL); } |