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

Function GetLocalAddress

src/net.cpp:221–224  ·  view source on GitHub ↗

Determine the "best" local address for a particular peer. If none, 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

219// the normal parameters, since the IP may be changed to a useful
220// one by discovery.
221CService GetLocalAddress(const CNode& peer)
222{
223 return GetLocal(peer).value_or(CService{CNetAddr(), GetListenPort()});
224}
225
226static int GetnScore(const CService& addr)
227{

Callers 3

GetLocalAddrForPeerFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
net.cppFile · 0.85

Calls 4

GetLocalFunction · 0.85
CNetAddrClass · 0.85
GetListenPortFunction · 0.85
value_orMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68