HomePhabricator

Net processing: Only call PushAddress() from net_processing

Description

Net processing: Only call PushAddress() from net_processing

Summary:

[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.

[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.

This is a backport of core#21187

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10922

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Jul 9 2020, 06:42
PiRKCommitted on Jan 28 2022, 10:23
PiRKPushed on Jan 28 2022, 10:23
Reviewer
Restricted Project
Differential Revision
D10922: Net processing: Only call PushAddress() from net_processing
Parents
rABC6865c990333f: [net processing] Refactor MaybeSendAddr()
Branches
Unknown
Tags
Unknown