Page MenuHomePhabricator

Net processing: Only call PushAddress() from net_processing
ClosedPublic

Authored by PiRK on Jan 28 2022, 09:03.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable