MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetLocalAddress

Function GetLocalAddress

src/net.cpp:208–218  ·  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

206// the normal parameters, since the IP may be changed to a useful
207// one by discovery.
208CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
209{
210 CAddress ret(CService(CNetAddr(),GetListenPort()), nLocalServices);
211 CService addr;
212 if (GetLocal(addr, paddrPeer))
213 {
214 ret = CAddress(addr, nLocalServices);
215 }
216 ret.nTime = GetAdjustedTime();
217 return ret;
218}
219
220static int GetnScore(const CService& addr)
221{

Callers 2

ProcessMessageMethod · 0.85
GetLocalAddrForPeerFunction · 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