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

Function GetLocalAddress

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

181// the normal parameters, since the IP may be changed to a useful
182// one by discovery.
183CAddress GetLocalAddress(const CNetAddr *paddrPeer)
184{
185 CAddress ret(CService("0.0.0.0",GetListenPort()),0);
186 CService addr;
187 if (GetLocal(addr, paddrPeer))
188 {
189 ret = CAddress(addr);
190 }
191 ret.nServices = nLocalServices;
192 ret.nTime = GetAdjustedTime();
193 return ret;
194}
195
196int GetnScore(const CService& addr)
197{

Callers 2

ProcessMessageFunction · 0.85
AdvertizeLocalFunction · 0.85

Calls 5

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

Tested by

no test coverage detected