MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetLocalAddress

Function GetLocalAddress

src/net.cpp:151–161  ·  view source on GitHub ↗

get best local address for a particular peer as a CAddress Otherwise, return the unroutable 0.0.0.0 but filled in with the normal parameters, since the IP may be changed to a useful one by discovery.

Source from the content-addressed store, hash-verified

149// the normal parameters, since the IP may be changed to a useful
150// one by discovery.
151CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
152{
153 CAddress ret(CService(CNetAddr(),GetListenPort()), nLocalServices);
154 CService addr;
155 if (GetLocal(addr, paddrPeer))
156 {
157 ret = CAddress(addr, nLocalServices);
158 }
159 ret.nTime = GetAdjustedTime();
160 return ret;
161}
162
163static int GetnScore(const CService& addr)
164{

Callers 2

ProcessMessageFunction · 0.85
AdvertiseLocalFunction · 0.85

Calls 6

GetListenPortFunction · 0.85
GetLocalFunction · 0.85
GetAdjustedTimeFunction · 0.85
CServiceClass · 0.70
CNetAddrClass · 0.70
CAddressClass · 0.70

Tested by

no test coverage detected